#!/usr/bin/perl -w
#
# print a list of images in an HTML document
# I don't remember if this is an example from some page, or if I wrote
# it - so I'm not gonna claim it. It's kinda handy, though. I think I
# must've based it on one of the HTML::TokeParser examples. I wonder if
# it still works... Maybe "lynx -source filename | printimages /dev/stdin"?
#
use HTML::TokeParser;
my $page = shift || die "Usage: $0 filename.html";
$p = HTML::TokeParser->new($page);
while (my $link = $p->get_tag("img")){
my $url = $link->[1]{src} || 'none';
my $text = $link->[1]{alt} || 'none';
print "$url\t$text\n";
}
exit(0) |