Hook::Scope - Perl extension for adding hooks for exiting a scope


Hook-Scope documentation  | view source Contained in the Hook-Scope distribution.

Index


NAME

Top

Hook::Scope - Perl extension for adding hooks for exiting a scope

SYNOPSIS

Top

  use Hook::Scope; 
  {
    Hook::Scope::POST(sub { print "I just left my scope"});
    print "you will see this first!";
  }

  use Hook::Scope qw(POST PRE);   # only POST can be exported
  {
    POST { print "foo" };
    POST  sub { print "bar"}; # can have multiple POSTs, last added, first run

    PRE  { print "this runs first" };
  }

ABSTRACT

Top

This module allows you to register subroutines to be executed when the scope they were registered in, has been left.

DESCRIPTION

Top

POST

POST takes a reference to a subroutine or a subroutine name and will register that subroutine to be executed when the scope is left. Note that even if the scope is left using die(), the subroutine will be executed.

EXPORT

None by default. POST can be exported if so required.

SEE ALSO

Top

Hook::LexWrap

Please report any bugs using the bug report interface at rt.cpan.org or using <bug-Hook-Scope@rt.cpan.org>

AUTHOR

Top

Arthur Bergman, <abergman@cpan.org>

Thanks go to Nick Ing-Simmons for the wicked idea of LEAVE;ENTER;.

COPYRIGHT AND LICENSE

Top


Hook-Scope documentation  | view source Contained in the Hook-Scope distribution.