HTML Tokeparser problem
Posted by TedH (TedH), 15 April 2007Hi Graham, got a bit of an odd one.
I'm using HTML::Tokeparser in a sub-routine and get an error.
Can't call method "get_tag" on an undefined value
My existing code:
Should it be:
It's odd, because the existing code works on one domain on my server fine. Exactly the same on another domain comes up with the error. I'm wondering if the code I've used is right in the way it uses the HTML::tokeparser module? If it isn't and the module is still waiting for something, then it might be possible that when I run the script on the second site the "HTML::tokeparser" won't work right because it's still waiting for the code on the first site's script to finish.
Deos that make sense?
Hope you can help,
thanks - Ted
Posted by admin (Graham Ellis), 19 April 2007Ted, sorry I've taken a while to follow up.
It won't be an issue with interacting sights, I'm sure - much more a data specific issue relating to the failing sight. But having said that, this isn't a module I use so I can't be too much further help.
By the way - are you sure that the error message related to the source code lines you gave (or to another call to get_tag, perhaps internal to another method? And is the second site different in any way - for example with badly formed tags? If you switch the sites round and analyse the second one first, how does the problem move?
Posted by TedH (TedH), 19 April 2007Hi Graham, been a bit busy today.
I've got some other domains of mine on the same server so uploaded the blog script to there. Did the comment and the mailout notification worked a treat. No Tokeparser error, just the proper deal, Got my email fine
I can only assume that the domain that had the error has some sort of setting I don't know about (odd?) so will have to contact my tech support.
Other than that, it's been nice and warm here. Was out for a bit this afternoon enjoying the weather. Kay says hi to Lisa.
Posted by TedH (TedH), 19 April 2007Graham, I have a funny feeling it's the domain name.
From what I can see CGI.pm and HTML Tokeparser both do a variety of things with the hyphen character. I don't understand it much, but, my domain name has a hyphen in. The other 2 domains I've tried this on do not have a hyphen.
Other stuff that uses CGI.pm works okay, it only appears to happen when used in conjunction with the Tokeparser module that I get an error on domain with a hyphen in.
Does that make sense?
Posted by admin (Graham Ellis), 20 April 2007I would test that hypothesis by running the same thing on identical code on two domains.
Will pass on your"hi" to Lisa - we're running a buisness networking evening here tonight!
Posted by TedH (TedH), 20 April 2007Hi Graham, just got finished doing all that.
I ran it on three domains, one with a hyphen in the domain name and it was the only one which errored.
I was just trying to get the title of the page from between the title tags. I've dropped the Tokeparser usage altogteher and just using the link to the page by itself.
Still seeing if I can do a really simple extraction to get the text between the title tags without using a module that might cause conflicts. I think LWP might do so am checking that out as it's standard on all servers (as far as I know). Thing is the script uses the CGI qw(:standard) on other bits.
B invited me to his network and I've signed on there. Never been on one before. Have fun this evening - Ted
Posted by TedH (TedH), 20 April 2007Okay Graham, sorted it. Back to one of the topics from Geekmas - K.I.S.S.
Instead of complex extraction methods, the data can just as easily be written into a variable in the first place, then called when needed. A lot less code and bother.
It's all about a comment function and notification on the blog sytem I'm writing (now at beta stage). So when a comment is made, the little 6 line script throws out the title in a variable and it gets sent along with a link when mailed out. Comments end with each month and all non-essential files are deleted including the one with that variable.
I'd complicated myself into a corner
cheers - Ted
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: firstname.lastname@example.org • WEB: http://www.wellho.net • SKYPE: wellho