Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: How to make a time-out with LWP::Simple

by Wonko the sane (Deacon)
on Mar 25, 2004 at 19:11 UTC ( #339840=note: print w/replies, xml ) Need Help??

in reply to How to make a time-out with LWP::Simple


I am not sure how you could catch a timeout set in UserAgent, but wrapping your call in an eval, with an alarm, would
probably fit your needs.

$SIG{ALRM} = sub { die q{timeout} }; URL: foreach my $url ( @urls ) { alarm( 2 ); # amount of time allowed for call. eval { my $page = get( $url ); # LWP::Simple call }; if ( $@ =~ /^timeout/ ) { print qq{Skipping this one, timed out.\n}; next URL; } # Do something with successful call. }


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://339840]
[marioroy]: kcott some time ago, somebody posted about slow logging. I forgot the post. I believed you had replied to it.
[marioroy]: ... among many workers. Somebody had ask how.
[marioroy]: It's not this thread Re^4: Mahalo - Thank you in Hawaii. Someone before had asked before about slow performance.

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2017-08-18 08:40 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (297 votes). Check out past polls.