| Hook-Scope documentation | view source | Contained in the Hook-Scope distribution. |
Hook::Scope - Perl extension for adding hooks for exiting a scope
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" };
}
This module allows you to register subroutines to be executed when the scope they were registered in, has been left.
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.
None by default. POST can be exported if so required.
Please report any bugs using the bug report interface at rt.cpan.org or using <bug-Hook-Scope@rt.cpan.org>
Arthur Bergman, <abergman@cpan.org>
Thanks go to Nick Ing-Simmons for the wicked idea of LEAVE;ENTER;.
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.
| Hook-Scope documentation | view source | Contained in the Hook-Scope distribution. |