Parser.pm and $*=1
Denis Roudenko (denis@elvis.msk.su)
Thu, 6 Mar 1997 17:33:02 +0300
Hello!
I've found that Parser.pm has strong requirement $*=0.
Another case, if html file containt comments, parser
does not work correctly.
I didnt see this requirement in LWP docs and
i am not sure that this condition is necessary.
As result I have lost two days with debugging one
of my huge program :((
Denis Roudenko.
denis@elvis.ru
P.S. This is a demo script and demo URL for this bug/mistake.
------------------------------------------------
#!/opt/perl/bin/perl
use HTML::Parse;
use HTML::LinkExtor;
use URI::URL;
use LWP::UserAgent;
$url_to_retreive="http://www.elvis.ru/~denis/test/test.html";
$parser=HTML::LinkExtor->new(\&print_ref, $url_to_retreive);
$ua = new LWP::UserAgent;
$url = new URI::URL($url_to_retreive);
$header = new HTTP::Headers
'Date' => HTTP::Date::time2str(time),
'Accept' => 'text/html',
;
$request = new HTTP::Request('GET', $url, $header);
$response = $ua->request($request);
$http_file = $response->as_string;
print "\nParse with \$\*\=0\n\n";
$parser->parse($http_file);
$*=1;
print "\nParse with \$\*\=1\n\n";
$parser->parse($http_file);
sub print_ref
{
my($tag, $type, $link)=@_;
print "Tag: $tag Type: $type Link: $link\n";
}
------------------------------------------------