in reply to Re^4: LWP for URL monitoring - 500 connect timeout errors
in thread LWP for URL monitoring - 500 connect timeout errors

I believe LWP is used quite extensively in Perl applications and that it works quite reliably. I haven't had any reliability problems myself, though my experience is somewhat limited.

You certainly can submit multiple requests in a single invocation of the script. It should be as simple as calling the request method of the user agent multiple times with the same request.

The following is untested, but might give you some ideas. You would have to initialize $ua, $req, $niterations, $maxerrors and $sleeptime.

my $errorcount = 0; my @errors; for (1..$niterations) { my $res = $ua->request($req) unless($res->is_success) { $errorcount++; push(@errors, $res->status_line); } $errorcount++ unless($res->is_success); sleep($sleeptime); } die "ERRORS:\n\t" . join("\n\t", @errors) . "\n" if($errors > $maxerrors); exit(0);

Welcome to the Monastery and good luck learning Perl.

Replies are listed 'Best First'.
Re^6: LWP for URL monitoring - 500 connect timeout errors
by Anonymous Monk on Jul 20, 2009 at 11:03 UTC