From: Vincent Pit Date: Mon, 10 Oct 2011 17:55:39 +0000 (+0200) Subject: Make sure the code snippets fit in 80-columns wide terminal X-Git-Tag: v0.18~2 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FScope-Upper.git;a=commitdiff_plain;h=444d78492ecace2f652fae44f177516b37bb18c0 Make sure the code snippets fit in 80-columns wide terminal --- diff --git a/lib/Scope/Upper.pm b/lib/Scope/Upper.pm index f2a97c5..7ebfca3 100644 --- a/lib/Scope/Upper.pm +++ b/lib/Scope/Upper.pm @@ -24,7 +24,10 @@ L, L, L, L and L : package Scope; - use Scope::Upper qw; + use Scope::Upper qw< + reap localize localize_elem localize_delete + :words + >; sub new { my ($class, $name) = @_; @@ -66,22 +69,22 @@ L, L, L, L and L : package UserLand; { - Scope->new("top"); # initializes $UserLand::tag + Scope->new("top"); # initializes $UserLand::tag { Scope->catch; - my $one = 1 + undef; # prints "top: Use of uninitialized value..." + my $one = 1 + undef; # prints "top: Use of uninitialized value..." { Scope->private; eval { require Cwd }; - print $@; # prints "Can't locate Cwd.pm in @INC (@INC contains:) at..." - } + print $@; # prints "Can't locate Cwd.pm in @INC + } # (@INC contains:) at..." - require Cwd; # loads Cwd.pm + require Cwd; # loads Cwd.pm } - } # prints "top: done" + } # prints "top: done" L and L : @@ -507,13 +510,13 @@ Where L fires depending on the C<$cxt> : { reap \&cleanup => $cxt; ... - } # $cxt = SCOPE(0), or HERE + } # $cxt = SCOPE(0) = HERE ... - }->(); # $cxt = SCOPE(1), or UP, or SUB, or CALLER, or CALLER(0) + }->(); # $cxt = SCOPE(1) = UP = SUB = CALLER(0) ... - }; # $cxt = SCOPE(2), or UP UP, or UP SUB, or EVAL, or CALLER(1) + }; # $cxt = SCOPE(2) = UP UP = UP SUB = EVAL = CALLER(1) ... - }->(); # $cxt = SCOPE(3), or SUB UP SUB, or SUB EVAL, or CALLER(2) + }->(); # $cxt = SCOPE(3) = SUB UP SUB = SUB EVAL = CALLER(2) ... Where L, L and L act depending on the C<$cxt> : @@ -523,19 +526,19 @@ Where L, L and L act depending on t sub { { localize '$x' => 1 => $cxt; - # $cxt = SCOPE(0), or HERE + # $cxt = SCOPE(0) = HERE ... } - # $cxt = SCOPE(1), or UP, or SUB, or CALLER, or CALLER(0) + # $cxt = SCOPE(1) = UP = SUB = CALLER(0) ... }->(); - # $cxt = SCOPE(2), or UP UP, or UP SUB, or EVAL, or CALLER(1) + # $cxt = SCOPE(2) = UP UP = UP SUB = EVAL = CALLER(1) ... }; - # $cxt = SCOPE(3), or SUB UP SUB, or SUB EVAL, or CALLER(2) + # $cxt = SCOPE(3) = SUB UP SUB = SUB EVAL = CALLER(2) ... }->(); - # $cxt = SCOPE(4), UP SUB UP SUB, or UP SUB EVAL, or UP CALLER(2), or TOP + # $cxt = SCOPE(4), UP SUB UP SUB = UP SUB EVAL = UP CALLER(2) = TOP ... Where L, L and L point to depending on the C<$cxt>: @@ -544,15 +547,15 @@ Where L, L and L point to depending on the C<$cxt>: eval { sub { { - unwind @things => $cxt; # or uplevel { ... } $cxt; + unwind @things => $cxt; # or uplevel { ... } $cxt; ... } ... - }->(); # $cxt = SCOPE(0 .. 1), or HERE, or UP, or SUB, or CALLER(0) + }->(); # $cxt = SCOPE(0) = SCOPE(1) = HERE = UP = SUB = CALLER(0) ... - }; # $cxt = SCOPE(2), or UP UP, or UP SUB, or EVAL, or CALLER(1) (*) + }; # $cxt = SCOPE(2) = UP UP = UP SUB = EVAL = CALLER(1) (*) ... - }->(); # $cxt = SCOPE(3), or SUB UP SUB, or SUB EVAL, or CALLER(2) + }->(); # $cxt = SCOPE(3) = SUB UP SUB = SUB EVAL = CALLER(2) ... # (*) Note that uplevel() will croak if you pass that scope frame,