#!/usr/bin/perl -w # # links # # Print all the documents linked to by an HTML file. (Not # things like stylesheets which are linked to in the head.) # # -- Ed Avis, epa98@doc.ic.ac.uk, 2001-05-28 # use strict; use HTML::TokeParser; use Log::TraceMessages qw(t d); Log::TraceMessages::check_argv(); die "usage: $0 FILES..." if not @ARGV; foreach (@ARGV) { my $p = HTML::TokeParser->new($_) or die "cannot open $_: $!"; while (my $t = $p->get_tag('a')) { my $href = $t->[1]{href}; print "$href\n" if defined $href; } }