1autodie::Scope::Guard(3U)ser Contributed Perl Documentatiaountodie::Scope::Guard(3)
2
3
4
6 autodie::Scope::Guard - Wrapper class for calling subs at end of scope
7
9 use autodie::Scope::Guard;
10 $^H{'my-key'} = autodie::Scope::Guard->new(sub {
11 print "Hallo world\n";
12 });
13
15 This class is used to bless perl subs so that they are invoked when
16 they are destroyed. This is mostly useful for ensuring the code is
17 invoked at end of scope. This module is not a part of autodie's public
18 API.
19
20 This module is directly inspired by chocolateboy's excellent
21 Scope::Guard module.
22
23 Methods
24 new
25
26 my $hook = autodie::Scope::Guard->new(sub {});
27
28 Creates a new "autodie::Scope::Guard", which will invoke the given sub
29 once it goes out of scope (i.e. its DESTROY handler is called).
30
32 Copyright 2008-2009, Paul Fenwick <pjf@perltraining.com.au>
33
35 This module is free software. You may distribute it under the same
36 terms as Perl itself.
37
38
39
40perl v5.30.1 2020-01-30 autodie::Scope::Guard(3)