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.
POST
None by default. POST can be exported if so required.
Hook::LexWrap
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.
2 POD Errors
The following errors were encountered while parsing the POD:
=cut found outside a pod block. Skipping to next block.
To install Hook::Scope, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Hook::Scope
CPAN shell
perl -MCPAN -e shell install Hook::Scope
For more information on module installation, please visit the detailed CPAN module installation guide.