I'm having trouble with timeouts in LWP on my Linux system, with Perl
5.00503, LWP 5.53, and IO::Socket 1.1603 (which came with this copy of
Perl, I believe).

This included test program takes several minutes to time out, instead
of the 5 seconds I've requested.  The timeout is in the request
portion of the transaction, not the DNS portion.

I was able to fix this by modifying IO::Socket.pm, but was wondering
if other people had this trouble, and if it was fixed in future
versions.

Could somebody with a similar version of Perl give this a try and let
me know how it goes, and also somebody with 5.6.x?

If this problem still exists, I'll try figure out how to get a fix
into the latest IO::Socket.pm; otherwise I'll just live with my own
fix until I upgrade.

Thanks,

----ScottG.

#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;

$url="http://1.2.3.4/";;
$timeout=5;


$ua = new LWP::UserAgent 
  or die "Error creating UA: $!";
$ua->agent("test.pl/0 " . $ua->agent);
$ua->timeout($timeout);
$request = new HTTP::Request('GET', $url) 
  or die "Error creating HTTP request: $!";
$response = $ua->simple_request($request, undef, undef)
  or die "Error requesting request: $!";

print "Request complete, code ",$response->code,"\n";

Reply via email to