in reply to Re^5: is there a way to ensure some code is the last thing that is run?
in thread is there a way to ensure some code is the last thing that is run?
is the same aspackage Blubb; ... package MAIN; my $b = Blubb->new; END { warn "END\n"; }
{ package Blubb; ... package MAIN; my $b = Blubb->new; END { warn "END\n"; } }
Since nothing captures $b, it ceases to exists as soon as the end of the lexical scope (the end of the file) is reached. If a sub were to capture $b, it would keep the variable alive until the sub was freed. This is usually during global destruction.
|
|---|