Aspect::Guard(3pm)

Aspect::Guard3pm

General purpose guard object for destroy-time actions

Usage

  SCOPE: {
  
      my $guard = Aspect::Guard->new( sub {
          print "Goodbye World!\n";
      } );
  
  }
  # Prints here as it exits the scope

Overview

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.

Releases

7 releases since Debian 7 (Wheezy); the text changed 4 times.

  1. 7
  2. 8–10
  3. 11
  4. 12
  5. 13

Author

Adam Kennedy <[email protected]>

From libaspect-perl 1.04-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.