Hook::LexWrapLexically scoped subroutine wrappers | |
Download |
Hook::LexWrap Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Publisher Name:
- Alexandr Ciornii
- Publisher web site:
- http://search.cpan.org/~chorny/
Hook::LexWrap Tags
Hook::LexWrap Description
Lexically scoped subroutine wrappers Hook::LexWrap is a Perl module that allows you to install a pre- or post-wrapper (or both) around an existing subroutine. Unlike other modules that provide this capacity (e.g. Hook::PreAndPost and Hook::WrapSub), Hook::LexWrap implements wrappers in such a way that the standard caller function works correctly within the wrapped subroutine.SYNOPSIS use Hook::LexWrap; sub doit { print ""; return {my=>"data"} } SCOPED: { wrap doit, pre => sub { print "\n" }, post => sub { print "\n"; $_=9; }; my $temporarily = wrap doit, post => sub { print "\n" }, pre => sub { print "\n "}; @args = (1,2,3); doit(@args); # pre2->pre1->doit->post1->post2 } @args = (4,5,6); doit(@args); # pre1->doit->post1 Requirements: · Perl
Hook::LexWrap Related Software