An example usage might be:
my $timeout = 20; eval { local $SIG{ALRM} = sub { die "timedout" }; alarm $timeout; #Call your subroutine here.... alarm 0; }; if ($@) { # $@ will contain error message, if any }
Hope this helps,
Darren :)
In reply to Re: Possible to write a sub that times out???
by McDarren
in thread Possible to write a sub that times out???
by geekondemand
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |