X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FScope%2FUpper.pm;h=4a9010059f7ce5112af17d57452539ae17458ff8;hb=9f4e270a50090f065bbeebbcac06fd6b4297e45c;hp=2ca1a2d64292e94031abad18b3fde8f184dcda46;hpb=2ede1b8c4c9b948ddfe278e44f19f4a57648cf10;p=perl%2Fmodules%2FScope-Upper.git
diff --git a/lib/Scope/Upper.pm b/lib/Scope/Upper.pm
index 2ca1a2d..4a90100 100644
--- a/lib/Scope/Upper.pm
+++ b/lib/Scope/Upper.pm
@@ -170,7 +170,7 @@ 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, and know which context was in use then with L ;
=item *
@@ -298,10 +298,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 restart 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,6 +316,38 @@ 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 restart 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