I am trying to use HTML::TokeParser
>From the cpan page for this I used this example :
while (my $token = $p->get_tag("a")) {
my $url = $token->[1]{href} || "-";
my $text = $p->get_trimmed_text("/a");
print "$url\t$text \n";
}
Worked great ::
So I tried to do something similar with the img tag ::
while (my $token = $p->get_tag("img")) {
my $src = $token->[1]{src} || "-";
my $alt = $token->[1]{alt} || "-";
print "$src\t$alt\n";
}
and I get nothing, even thought I know there are lots of image tags
Any body know what I could be doing wrong or other wsie how to grab certain attributs
form certain tags ?
Not sure what the || "-" is for but it works on the a href attribute
http://search.cpan.org/author/GAAS/HTML-Parser-3.27/lib/HTML/TokeParser.pm
Thanks
Dan