X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;ds=inline;f=lib%2FScope%2FUpper.pm;h=57e312d3b06af7b04da7e0cf238141d1e5b2a6da;hb=d3500bc9b8882716ee933336bb903e20735e54ed;hp=2ca1a2d64292e94031abad18b3fde8f184dcda46;hpb=2ede1b8c4c9b948ddfe278e44f19f4a57648cf10;p=perl%2Fmodules%2FScope-Upper.git
diff --git a/lib/Scope/Upper.pm b/lib/Scope/Upper.pm
index 2ca1a2d..57e312d 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.19
+Version 0.20
=cut
our $VERSION;
BEGIN {
- $VERSION = '0.19';
+ $VERSION = '0.20';
}
=head1 SYNOPSIS
@@ -170,7 +170,11 @@ localize variables, array/hash values or deletions of elements in higher context
=item *
-return values immediately to an upper level with L, and know which context was in use then with L ;
+return values immediately to an upper level with L, L and L ;
+
+=item *
+
+gather information about an upper context with L and L ;
=item *
@@ -298,10 +302,11 @@ C<$key> is ignored.
=head2 C
- unwind @values;
+ unwind;
unwind @values, $context;
-Returns C<@values> I the context pointed by C<$context>, i.e. from the subroutine, eval or format at or just above C<$context>, and immediately restart the program flow at this point - thus effectively returning to an upper scope.
+Returns C<@values> I the subroutine, eval or format context pointed by or just above C<$context>, and immediately restarts the program flow at this point - thus effectively returning C<@values> to an upper scope.
+If C<@values> is empty, then the C<$context> parameter is optional and defaults to the current context (making the call equivalent to a bare C) ; otherwise it is mandatory.
The upper context isn't coerced onto C<@values>, which is hence always evaluated in list context.
This means that
@@ -315,14 +320,49 @@ This means that
will set C<$num> to C<'z'>.
You can use L to handle these cases.
+=head2 C
+
+ yield;
+ yield @values, $context;
+
+Returns C<@values> I the context pointed by or just above C<$context>, and immediately restarts the program flow at this point.
+If C<@values> is empty, then the C<$context> parameter is optional and defaults to the current context ; otherwise it is mandatory.
+
+L differs from L in that it can target I upper scope (besides a C substitution context) and not necessarily a sub, an eval or a format.
+Hence you can use it to return values from a C or a C