X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FScope%2FContext.pm;h=fbe115bdff5c1199f030fb064b59f82d6fcbe7ac;hb=22cad1bc4b5f4acb14860f34ad02c95f9c5a679d;hp=cd0d63067321cbd2f480427e728a25c9e6e1ecb4;hpb=ef7fb9be92dc53c6846a6021f4681a6ef23197b3;p=perl%2Fmodules%2FScope-Context.git diff --git a/lib/Scope/Context.pm b/lib/Scope/Context.pm index cd0d630..fbe115b 100644 --- a/lib/Scope/Context.pm +++ b/lib/Scope/Context.pm @@ -232,7 +232,7 @@ Returns a boolean indicating whether a new instance of C<@_> was set up for this $cxt->gimme; -Returns the context (in the sense of L) in which the scope denoted by the invocant is executed. +Returns the context (in the sense of C : C for void context, C<''> for scalar context, and true for list context) in which the scope denoted by the invocant is executed. =head2 C @@ -293,7 +293,7 @@ BEGIN { my \$info = \$self->{info}; \$info = \$self->{info} = [ Scope::Upper::context_info(\$self->cxt) ] - unless \$info; + unless \$info; return \$info->[$idx]; } @@ -306,7 +306,7 @@ BEGIN { my $want = $cxt->want; -Returns the Perl context (in the sense of C : C for void context, C<''> for scalar context, and true for list context) in which is executed the scope pointed by the invocant. +Returns the Perl context (in the sense of C) in which is executed the closest subroutine, eval or format enclosing the scope pointed by the invocant. =cut @@ -333,7 +333,7 @@ If omitted, C<$frames> defaults to C<1>. sub { { { - my $up = Scope::Context->new->up(2); # = Scope::Context->up(2) + my $up = Scope::Context->new->up(2); # == Scope::Context->up(2) # $up points two contextes above this one, which is the sub. } } @@ -365,7 +365,7 @@ sub up { my $sub_cxt = $cxt->sub($frames); my $sub_cxt = Scope::Context->sub; -Returns a new L object pointing to the C<$frames>-th subroutine scope above the scope pointed by the invocant. +Returns a new L object pointing to the C<$frames + 1>-th subroutine scope above the scope pointed by the invocant. This method can also be invoked as a class method, in which case it is equivalent to calling L on a L object for the current context. @@ -378,7 +378,7 @@ If omitted, C<$frames> defaults to C<0>, which results in the closest sub enclos } sub inner { - my $sub = Scope::Context->new->sub(1); # = Scope::Context->sub(1) + my $sub = Scope::Context->new->sub(1); # == Scope::Context->sub(1) # $sub points to the context for the outer() sub. } @@ -409,7 +409,7 @@ sub sub { my $eval_cxt = $cxt->eval($frames); my $eval_cxt = Scope::Context->eval; -Returns a new L object pointing to the C<$frames>-th C scope above the scope pointed by the invocant. +Returns a new L object pointing to the C<$frames + 1>-th C scope above the scope pointed by the invocant. This method can also be invoked as a class method, in which case it is equivalent to calling L on a L object for the current context. @@ -417,7 +417,7 @@ If omitted, C<$frames> defaults to C<0>, which results in the closest eval enclo eval { sub { - my $eval = Scope::Context->new->eval; # = Scope::Context->eval + my $eval = Scope::Context->new->eval; # == Scope::Context->eval # $eval points to the eval context. }->() } @@ -447,7 +447,7 @@ sub eval { $cxt->reap($code); -Execute C<$code> when the scope pointed by the invocant ends. +Executes C<$code> when the scope pointed by the invocant ends. See L for details. @@ -465,7 +465,7 @@ sub reap { $cxt->localize($what, $value); -Localize the variable described by C<$what> to the value C<$value> when the control flow returns to the scope pointed by the invocant. +Localizes the variable described by C<$what> to the value C<$value> when the control flow returns to the scope pointed by the invocant, until said scope ends. See L for details. @@ -483,7 +483,7 @@ sub localize { $cxt->localize_elem($what, $key, $value); -Localize the element C<$key> of the variable C<$what> to the value C<$value> when the control flow returns to the scope pointed by the invocant. +Localizes the element C<$key> of the variable C<$what> to the value C<$value> when the control flow returns to the scope pointed by the invocant, until said scope ends. See L for details. @@ -501,7 +501,7 @@ sub localize_elem { $cxt->localize_delete($what, $key); -Delete the element C<$key> from the variable C<$what> when the control flow returns to the scope pointed by the invocant. +Deletes the element C<$key> from the variable C<$what> when the control flow returns to the scope pointed by the invocant, and restores it to its original value when said scope ends. See L for details.