hi
i have a problem with lwp.
i have a script below that basically just checks 3 urls for errors. two of
these urls are identical.
as soon as i get one error from one url all the following ones will also get
an error. so if i change the order in the @urls array with all the positively
good ones first they will be ok, but if do the opposite the good ones will get
an error.
im sure there an innocent explanation to this, but i can see it right now.
../allan
__________________
#!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new(env_proxy => 1,
keep_alive => 1,
timeout => 30,
);
my $msg = "";
my $browser = LWP::UserAgent->new;
my $counter = 0;
my @urls = qw(http://www.bullitt.suite.dk/index.html
http://www.bullitt.suite.dk/404.html http://www.bullitt.suite.dk/index.html);
foreach my $url (@urls) {
$counter++;
my $response = $browser->get($url,);
my $t_response = $ua->get($url);
$msg = $t_response->status_line unless $t_response->is_success;
if ($msg eq "") {
print "\n$counter OK: $url\n";
} else {
print "\n$counter ERROR: $msg for $url\n";
}
}
__END__