Go to main content

man pages section 3: Library Interfaces and Headers

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

autodie::Scope::Guard (3)

Name

autodie::Scope::Guard - Wrapper class for calling subs at end of scope

Synopsis

use autodie::Scope::Guard;
$^H{'my-key'} = autodie::Scope::Guard->new(sub {
print "Hallo world\n";
});

Description

Perl Programmers Reference Guide                      autodie::Scope::Guard(3)



NAME
       autodie::Scope::Guard - Wrapper class for calling subs at end of scope

SYNOPSIS
           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 public
       API.

       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).

AUTHOR
       Copyright 2008-2009, Paul Fenwick <pjf@perltraining.com.au>

LICENSE
       This module is free software.  You may distribute it under the same
       terms as Perl itself.



ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+-----------------------+
       |ATTRIBUTE TYPE |   ATTRIBUTE VALUE     |
       +---------------+-----------------------+
       |Availability   | runtime/perl-532      |
       +---------------+-----------------------+
       |Stability      | Pass-through volatile |
       +---------------+-----------------------+

NOTES
       Source code for open source software components in Oracle Solaris can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-
       code-downloads.html.

       This software was built from source available at
       https://github.com/oracle/solaris-userland.  The original community
       source was downloaded from
       http://www.cpan.org/src/5.0/perl-5.32.0.tar.gz.

       Further information about this software can be found on the open source
       community website at https://www.perl.org/.



perl v5.32.0                      2020-06-14          autodie::Scope::Guard(3)