Sorry, that was not meant to escape as HTML mail... here we are in ASCII, I
hope:
At 11:11 AM 2/25/02 +1030, Daniel Falkenberg wrote:
>I went ahead and started using HTML::TokeParser and I have read the
>HTML::TokeParser manpage. I am sure my coding is correct but for some
>reason the script always returns this error...
>
>Can't call method "get_tag" on an undefined value at
>/var/www/cgi-bin/<nameofscript> line 321.
>
>Here is how the code looks...
> $p = HTML::TokeParser->new(shift||$content);
> if ($p->get_tag("title")) {
> my $title = $p->get_trimmed_text;
> print "Title: $title\n";
> }
>
>Can any one see anything wrong with this?
From the HTML::TokeParser documentation:
$p = HTML::TokeParser->new( $file_or_doc );
The object constructor argument is either a file name, a file handle
object, or the complete document to be parsed.
If the argument is a plain scalar, then it is taken as the name of a file
to be opened and parsed. If the file can't be opened for reading, then the
constructor will return an undefined value and $! will tell you why it failed.
You didn't pass a file or document to the constructor, you passed a
URL. And you didn't check $! to see why it failed.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]