I mean fixing the url to convert relative to absolute pathnames. Just include tokeparser as suggested and you're there.
something like this: (btw. not my code from http://perl.com):
#!/usr/bin/perl
use strict;
use warnings;
use LWP;
use URI;
my $browser = LWP::UserAgent->new;
my $url = 'http://www.cpan.org/RECENT.html';
my $response = $browser->get($url);
die "Can't get $url -- ", $response->status_line
unless $response->is_success;
my $html = $response->content;
while( $html =~ m/<A HREF=\"(.*?)\"/g ) {
print URI->new_abs( $1, $response->base ) ,"\
+n";
}
teabag
-- Siggy Played Guitar
Sure there's more than one way, but one just needs one anyway - Teabag
|