in reply to Re3: How to detect a die() without catching it?
in thread How to detect a die() without catching it?
But I think my concern about the call stack still stands. How can a single global handler be enough?
UPDATE: To clarify, here's an example of how $SIG{__DIE__} doesn't behave the way I think I would need it to:
sub catcher { local $SIG{__DIE__} = sub { print "Caught 1!\n"; }; catcher2(); } sub catcher2 { local $SIG{__DIE__} = sub { print "Caught 2!\n"; }; sub_that_dies(); } sub sub_that_dies { die "Foo"; } catcher();
Now, I'd like that code to print both "Caught 1!" and "Caught 2!". But what it actually does is less useful:
$ perl bomb.pl Caught 2! Foo at bomb.pl line 30.
Does that make it clear what I mean?
-sam
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re3: How to detect a die() without catching it?
by belg4mit (Prior) on May 17, 2002 at 23:37 UTC | |
by samtregar (Abbot) on May 18, 2002 at 01:04 UTC |