POSIX::_exit を呼べばグローバルデストラクションは走らない
perldoc POSIX には、
_exit This is identical to the C function "_exit()". It exits the program immediately which means among other things buffered I/O is not flushed.
としか書いてないけど、もちろん global destruction も走らない。
use strict; use warnings; use POSIX; use Scope::Guard; my $sg = Scope::Guard->new(sub { warn "POSIX::_exit で終了すると呼ばれない"; }); POSIX::_exit(0);