in reply to die silently in an eval block while using alarm
I can't really see, how "die" in your code could produce any output. It is called by ALRM signal handler inside of eval, so the output of "die" is saved in $@ and not printed anywhere. If you get some output, then it comes from somewhere else. Check for example this code
You'll never see "Waiting finished" because it is stored in $@ variable and the code does not print it.my $ch; eval{ $SIG{ALRM} = sub{ die "Waiting finished\n"; }; alarm(10); $ch = <STDIN>; alarm(0); }; if($@) { print "Timeout happened\n"; } else { print "Got $ch"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: die silently in an eval block while using alarm
by gg48gg (Sexton) on Feb 22, 2013 at 21:55 UTC | |
by andal (Hermit) on Feb 25, 2013 at 09:56 UTC |