X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FScope%2FUpper.pm;h=66f225f8a3f60913f54734a1dd94b608bbeb6945;hb=371ac1f7b00e6de2149f97693fdcbbfe44388f43;hp=a315552a6479e83c0121400c3a826e7eece1ebb9;hpb=7c5f28e56c17629e34fa0b2e6e4626e040f9c21d;p=perl%2Fmodules%2FScope-Upper.git diff --git a/lib/Scope/Upper.pm b/lib/Scope/Upper.pm index a315552..66f225f 100644 --- a/lib/Scope/Upper.pm +++ b/lib/Scope/Upper.pm @@ -9,13 +9,13 @@ Scope::Upper - Act on upper scopes. =head1 VERSION -Version 0.03 +Version 0.04 =cut our $VERSION; BEGIN { - $VERSION = '0.03'; + $VERSION = '0.04'; } =head1 SYNOPSIS @@ -56,6 +56,26 @@ BEGIN { ... } # "pie: done" is printed + package Z; + + use Scope::Upper qw/unwind want_at :words/; + + sub try (&) { + my @result = shift->(); + my $cx = SUB UP SUB; + unwind +(want_at($cx) ? @result : scalar @result) => $cx; + } + + ... + + sub zap { + try { + return @things; # returns to try() and then outside zap() + } + } + + my @what = zap(); # @what contains @things + =head1 DESCRIPTION This module lets you defer actions that will take place when the control flow returns into an upper scope.