P
P.R.Brady
TokeParser looks a really useful tool for parsing HTML but will it only
take input from a file? Is it possible to get it to munge a web page
directly or even a scalar holding the page content (eg previously
grabbed with get)?
This works:
use warnings;
use HTML::TokeParser;
$file='c:/Perl/html/index.html';
$p = HTML::TokeParser->new($file) ||
die "Can't open: $!";
while (my $token = $p->get_token) {
print ${$token}[0],"\n";
# etc
}
but not:
$file='file:///c:/Perl/html/index.html';
or
$file='http://www.bangor.ac.uk/';
I'm running version v5.6.1 under Windoze.
Regards
Phil
take input from a file? Is it possible to get it to munge a web page
directly or even a scalar holding the page content (eg previously
grabbed with get)?
This works:
use warnings;
use HTML::TokeParser;
$file='c:/Perl/html/index.html';
$p = HTML::TokeParser->new($file) ||
die "Can't open: $!";
while (my $token = $p->get_token) {
print ${$token}[0],"\n";
# etc
}
but not:
$file='file:///c:/Perl/html/index.html';
or
$file='http://www.bangor.ac.uk/';
I'm running version v5.6.1 under Windoze.
Regards
Phil