in reply to Eval not catching Dies
Are you trying to catch the die() after the eval()? If so, my best guess is the fact that the perldoc for alarm says that the die() in the sig handler must terminate with a newline. So you just might need this instead (just a guess, I really don't know if this will help at all). Note that I took out the state handler. You really shouldn't need that unless you need to maintain state further.
my $cmd; eval { local $SIG{'ALRM'} = sub { die "DIED\n" }; local $SIG{'CHLD'} = sub { die "DIED\n" }; $cmd = <STDIN>; }; if ($@) { die $@ eq "DIED\n" ? "We died from a sig handler\n" : "Other death: $@\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Eval not catching Dies
by Anonymous Monk on Dec 08, 2003 at 19:02 UTC | |
by Anonymous Monk on Dec 08, 2003 at 19:16 UTC |