http://www.perlmonks.org?node_id=629681


in reply to detecting timeout in LWP

The status line should contain timeout details. Mine looked like this after a test run:

500 Can't connect to mypoorcomputer.org (connect: timeout)
# ... $ua->timeout(10); my $response = $ua->request($r); if ($response->is_success) { print "whee.\n"; } elsif ($response->status_line =~ /timeout/) { die "Timed out\n"; } else { die $response->status_line; }