Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use Hook::LexWrap;
- sub doit { print "[doit:", caller, "]"; return {my=>"data"} }
- SCOPED: {
- wrap doit =>
- pre => sub { print "[pre1: @_]\n" },
- post => sub { print "[post1:@_]\n"; $_[1]=9; };
- my $temporarily = wrap doit =>
- post => sub { print "[post2:@_]\n" },
- pre => sub { print "[pre2: @_]\n "};
- @args = (1,2,3);
- doit(@args); # pre2->pre1->doit->post1->post2
- }
- @args = (4,5,6);
- doit(@args); # pre1->doit->post1
- ----------------------------------------------
- sub doit { print "[doit:", caller, "]"; return {my=>"data"} }
- ENTER &doit { print "[pre1: @_]\n" }
- LEAVE &doit { print "[post1:@_]\n"; $_[1]=9; }
- SCOPED: {
- ENTER &doit { print "[post2:@_]\n" }
- LEAVE &doit { print "[pre2: @_]\n"}
- @args = (1,2,3);
- doit(@args); # pre2->pre1->doit->post1->post2
- }
- @args = (4,5,6);
- doit(@args); # pre1->doit->post1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement