%SIG says "When a __DIE__ hook routine returns, the exception processing continues as it would have in the absence of the hook, unless the hook routine itself exits via a goto &sub, a loop exit, or a die()". Presumably "continues as it would have in the absence of the hook" means it dies, but what does "the hook routine itself exits via ... a loop exit" mean? Attempts:
$ perl -Mstrict -wE'$SIG{__DIE__}=sub{last}; die "hi"'
Exiting subroutine via last at -e line 1.
Can't "last" outside a loop block at -e line 1.
# no strict
$ perl -wE'$SIG{__DIE__}=sub{last}; die "hi"'
Exiting subroutine via last at -e line 1.
Can't "last" outside a loop block at -e line 1.
# no warnings
$ perl -E'$SIG{__DIE__}=sub{last}; die "hi"'
Can't "last" outside a loop block at -e line 1.
# -e instead of -E
$ perl -e'$SIG{__DIE__}=sub{last}; die "hi"'
Can't "last" outside a loop block at -e line 1.
# put last in a while loop, dies
$ perl -e'$SIG{__DIE__}=sub{while(1){last}}; die "hi"'
hi at -e line 1.
# put last in a non-loop block, dies
$ perl -e'$SIG{__DIE__}=sub{{last}}; die "hi"'
hi at -e line 1.
Edit:
$ perl --version
This is perl 5, version 38, subversion 2 (v5.38.2) built for x86_64-ms
+ys-thread-multi
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.