HTML::HeadParser doesn't return undef when there's no title
Christopher Russo (crusso@mit.edu)
Sat, 15 Mar 1997 20:45:39 -0500
Hi-
I've been using HTML::HeadParser to strip the titles from some pages, and I
think I've found run into a small problem. I'm using code similar to the
following:
$hp = HTML::HeadParser->new;
foreach $filename (@files) {
$hp->parse_file($filename);
print "$filename\t\t",$hp->header('Title'),"\n";
}
and it works fine as long as the document has a <title> tag, but if it
doesn't, it retains the value of the last $foo->header('Title') call until
it comes across another document with a <title> tag.
Of course, a simple /<title>(.*)<\/title>/i works as would keeping track of
the result of the last header method call, but I thought I should report
what seems to be a minor bug.
Chris Russo
crusso@mit.edu