$main::SIG{__DIE__} = \&some_function; # when does this get run?
It gets run at the same time as any other code in the same place would. Give it a try:
#!/usr/bin/perl use strict; use warnings; use feature qw/say/; sub function { say "Howdy!"; } #die "horribly"; $main::SIG{__DIE__} = \&function; #die "horribly"; #BEGIN { die "horribly"; }
Try uncommenting each of the various dies; only the one that dies after the signal handler has been assigned will produce a "Howdy!". No implicit blocks of any kind are involved.
Alternatively, check with -MO=Deparse.
In reply to Re^5: SIG, Modules, and Eval
by AppleFritter
in thread SIG, Modules, and Eval
by kbrannen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |