in reply to Re^2: Self terminating a script after a specified time
in thread Self terminating a script after a specified time
Time::Limit sends the process a SIGTERM, which you can catch.The following exits with a zero exit code after 5 seconds:
use Time::Limit -quiet, '5'; $SIG{TERM} = sub { exit 0 }; while(1) {}
|
|---|