logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Aspect::Guard - General purpose guard object for destroy-time actions

Author

       Adam Kennedy <adamk@cpan.org>

Description

       The Aspect::Guard class shipping with Aspect is a convenience module for creating "CODE" based objects
       that execute when they fall out of scope.

       It's usage is effectively summarised by the synopsis.

Methods

new
         my $guard = Aspect::Guard->new( sub { do_something(); } );

       The "new" method creates a new guard object. It takes a single "CODE" references as a parameter, which it
       will bless into the guard class, which will execute the code reference when it's "DESTROY" hook is
       called.

Name

       Aspect::Guard - General purpose guard object for destroy-time actions

Synopsis

         SCOPE: {

             my $guard = Aspect::Guard->new( sub {
                 print "Goodbye World!\n";
             } );

         }
         # Prints here as it exits the scope

See Also