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; }
In reply to Re: How to set timer in perl
by hbm
in thread How to set timer in perl
by Rahul Gupta
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |