autodie::Scope::Guard (3)
Leading comments
Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) Standard preamble: ========================================================================
NAME
autodie::Scope::Guard - Wrapper class for calling subs at end of scopeSYNOPSIS
use autodie::Scope::Guard; $^H{'my-key'} = autodie::Scope::Guard->new(sub { print "Hallo world\n"; });
DESCRIPTION
This class is used to bless perl subs so that they are invoked when they are destroyed. This is mostly useful for ensuring the code is invoked at end of scope. This module is not a part of autodie's publicAPI.
This module is directly inspired by chocolateboy's excellent Scope::Guard module.
Methods
new
my $hook = autodie::Scope::Guard->new(sub {});
Creates a new "autodie::Scope::Guard", which will invoke the given sub once it goes out of scope (i.e. its
DESTROY
handler is called).