To give a concrete example of that:
use warnings; my @list = (); eval { local $SIG{ALRM} = sub { die "SSH timed out" }; alarm 5; #If after 5 seconds nothing happens, then call SIGALRM @list = `ssh machine "ls path"`; alarm 0; #Reset }; if( $@ ) { warn "I could not do that: $@"; } else { do_something_with( @list ); }
Update: After being corrected, I have changed the code to make it work
In reply to Re^2: Timing out ``?
by thomas895
in thread Timing out ``?
by slgilley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |