in reply to LWP timeout

Something like this should be possible:
$ua -> timeout(45); $SIG{'ALRM'} = sub { die ("Timeout after 45 seconds"); };
So you first set the timeout to 45 seconds and afterwards you connect the 'ALRM' signal to a subroutine that deals with what to do with it...

Jouke Visser, Perl 'Adept'

Replies are listed 'Best First'.
Re: Re: LWP timeout
by arhuman (Vicar) on Apr 02, 2001 at 18:17 UTC
    You must be warned of one potential pitfall :

    The timeout may seem to NOT work, if the host you're trying to connect is unreachable
    (you may wait long minutes whatever the number of seconds you used in your timeout() function...)
    See this post for more info.


    "Only Bad Coders Badly Code In Perl" (OBC2IP)