- Notifications
You must be signed in to change notification settings - Fork587
Closed
Description
Description
If you register a subroutine as a$SIG{__DIE__}
handler, then call it normally, and that sub then (directly or indirectly) throws an exception, the$SIG{__DIE__}
behavior doesn't kick in; i.e. the sub is not re-invoked to handle the exception.
Steps to Reproduce
$ perl -we 'my $x = 0; sub foo { print "foo()\n"; die $x++ } $SIG{__DIE__} = \&foo; foo'foo()0 at -e line 1.
(Note that$SIG{__DIE__}
has no effect here.)
Expected behavior
$ perl -we 'my $x = 0; sub foo { print "foo()\n"; die $x++ } $SIG{__DIE__} = \&foo; foo'foo()foo()1 at -e line 1.
There should be exactly two calls to foo: One fromfoo
in the main code, the other via$SIG{__DIE__}
. It should not recurse further because asperldoc -v %SIG
explains:
The
__DIE__
handler is explicitly disabled during the call, so that you can die from a__DIE__
handler.
Metadata
Metadata
Assignees
Labels
No labels