in reply to The curious case of LWP - the SIG{ALRM} robber

I took your sample and experimented with it.
#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; my $mac = 'http://www.perlmonks.org/?node_id=848086'; eval { do { my $request = HTTP::Request->new( GET => $mac ); my $ua = LWP::UserAgent->new; $ua->timeout(30); $ua->env_proxy; my $response = $ua->request($request); if ( $response->is_success ) { print $response->decoded_content; } else { print $response->status_line, "\n"; } }; }
Update: I took out $SIG{ALRM}. It didn't work and seemed unnecessary. Added print to status_line and timeout. "status_line' works better.

Replies are listed 'Best First'.
Re^2: The curious case of LWP - the SIG{ALRM} robber
by MonkeyMonk (Sexton) on Jul 07, 2010 at 10:07 UTC
    Can you try it with say:

  • a non-existent IP
  • a wrong fqdn
  • a very slow server
  • Setting timeout to say 10 without the Alarm for userAgent object will have no effect. This is I think is valid for 5.8.4