Here is an example from alarm in the perlfunc manpage:
eval { local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required alarm $timeout; $nread = sysread SOCKET, $buffer, $size; alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; # propagate unexpected errors # timed out } else { # didn't } __END__
You could probably adapt this to do what you need.
Update: Link fixed.
In reply to Re: killing a process after some time
by kejohm
in thread killing a process after some time
by perlrocks
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |