in reply to LWP Timouts
Sys::SigAction gives you the most reliable signal handling, and therefore timeout handling.#timeout a system call: use Sys::SigAction qw( set_sig_handler ); eval { my $h = set_sig_handler( 'ALRM' ,\&mysubname ,{ mask=>'AL +RM' ,safe=>1 } ); alarm(2) ... do something you want to timeout alarm(0); }; #signal handler is reset when $h goes out of scope alarm(0); if ( $@ ) ...
|
|---|