in reply to How to set timer in perl
I've only needed alarm once, and this worked:
eval { local $SIG{__DIE__} = 'DEFAULT'; local $SIG{ALRM} = sub { die "timeout" }; alarm 2700; # do things alarm 0; }; if ($@) { if ($@ =~ "timeout" ) { ... } else { print "$@\n"; } alarm 0; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to set timer in perl
by perlfan (Parson) on Jun 13, 2013 at 16:05 UTC |