The test script is at: and the source code for this test harness is at:
I'm stumped
[edited by: jatar_k at 7:48 pm (utc) on Jan. 10, 2004]
[edit reason] no personal urls thanks [/edit]
One of the examples in the end of the book is a link checking spider, much like what you want.
Sean
[edited by: jatar_k at 4:44 am (utc) on Jan. 11, 2004]
[edit reason] no personal urls thanks [/edit]
Now I have seen the code though may I suggest using LWP::UserAgent to check the status of the pages rather than IO::Socket for 2 main reasons.
#1. It is MUCH simpler
#2. It supports http 1.1 by default
The script is falling over as it is sending a 1.0 request (no problem there) but the server is sending back a 1.1 redirection which the script can't work with.
LWP version (lifted straight from http:// search. cpan.org/~gaas/libwww-perl-5.76/lib/LWP/UserAgent.pm)
require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
my $response = $ua->get('http://search.cpan.org/');
if ($response->is_success) {
print $response->content; # or whatever
}
else {
die $response->status_line;
}