in reply to Module that runs task after script that runs it finished
Another method to run stuff at the end of a program (or at the end of any scope) is to use one of AtExit, Guard or Scope::Guard, which are basically all objects that have a DESTROY method which does all the work:
sub at_exit { my ($callback) = @_; bless 'At::Exit', \$callback; }; sub At::Exit::DESTROY { $_[0]->(); };
But the difference to a normal END block is very small, and without more knowledge about how normal END blocks don't work for you, it's hard to know whether this solution will work better.
|
|---|