NAME

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

SYNOPSIS

  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

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

DESCRIPTION

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

Hook::LexWrap

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

AUTHOR

Arthur Bergman, <abergman@cpan.org>

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

COPYRIGHT AND LICENSE

Copyright 2002 by Arthur Bergman

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 103:

=cut found outside a pod block. Skipping to next block.

Around line 139:

=cut found outside a pod block. Skipping to next block.