use more complex:eval { local $SIG{ALRM} = sub {die "alarm here"}; alarm(5); long_code(); alarm(0); }
I 100% agree with need of second internal eval if long_code can call die(). But I also have two questions:eval { local $SIG{ALRM} = sub {die "alarm here"}; alarm(5); eval { long_code(); }; alarm(0); # see QUESTION 2 below } alarm(0); # see QUESTION 1 below die if $@ && $@ !~ /alarm here/;
In reply to second alarm(0) by powerman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |