X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=samples%2Ftry.pl;h=e207e14beef5e9b22bcd8213ed21e0e31fc6a79e;hb=7a192f2ff19c1882fb55fccabac1fc6d9105fb29;hp=305a0ec3bef65ec86220ecd60386bd0adf11d595;hpb=a09dde4832af673cb9fc0c32222db6da34d70999;p=perl%2Fmodules%2FScope-Upper.git diff --git a/samples/try.pl b/samples/try.pl index 305a0ec..e207e14 100644 --- a/samples/try.pl +++ b/samples/try.pl @@ -5,23 +5,23 @@ use warnings; use blib; -use Scope::Upper qw/unwind want_at :words/; +use Scope::Upper qw; sub try (&) { my @result = shift->(); - my $cx = SUB UP SUB; + my $cx = SUB UP; # Point to the sub above this one unwind +(want_at($cx) ? @result : scalar @result) => $cx; } sub zap { try { - my @things = qw/a b c/; + my @things = qw; return @things; # returns to try() and then outside zap() }; print "NOT REACHED\n"; } -my @what = zap(); # @what contains qw/a b c/ -my $what = zap(); # $what contains 3 +my @stuff = zap(); # @stuff contains qw +my $stuff = zap(); # $stuff contains 3 -print "zap() returns @what in list context and $what in scalar context\n"; +print "zap() returns @stuff in list context and $stuff in scalar context\n";