=head1 VERSION
-Version 0.02
+Version 0.03
=cut
-our $VERSION = '0.02';
+our $VERSION = '0.03';
=head1 SYNOPSIS
$cxt->gimme;
-Returns the context (in the sense of L<perlfunc/wantarray>) in which the scope denoted by the invocant is executed.
+Returns the context (in the sense of C<perlfunc/wantarray> : C<undef> for void context, C<''> for scalar context, and true for list context) in which the scope denoted by the invocant is executed.
=head2 C<eval_text>
my \$info = \$self->{info};
\$info = \$self->{info} = [ Scope::Upper::context_info(\$self->cxt) ]
- unless \$info;
+ unless \$info;
return \$info->[$idx];
}
my $want = $cxt->want;
-Returns the Perl context (in the sense of C<wantarray> : C<undef> 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<perlfunc/wantarray>) in which is executed the closest subroutine, eval or format enclosing the scope pointed by the invocant.
=cut
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.
}
}
}
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.
}
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.
}->()
}
$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<Scope::Upper/reap> for details.
$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<Scope::Upper/localize> for details.
$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<Scope::Upper/localize_elem> for details.
$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<Scope::Upper/localize_delete> for details.
=head1 DEPENDENCIES
-L<Carp> (core module since perl 5), L<Scalar::Util> (since 5.7.3).
+L<Carp> (core module since perl 5), L<overload> (since 5.2.0), L<Scalar::Util> (since 5.7.3).
L<Scope::Upper> 0.21.