Caveats: doesn't work if the program uses eval or sleep, and might not work with retry I/O models. (But beginners aren't likely to use these things!)
BEGIN { $SIG{ALRM} = sub { die "Infinite loop aborted" }; alarm 30; # or however long you want before you time out (in seconds +) }
In reply to Poor man's setrlimit by merlyn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |