Scope::Upper - Act on upper scopes.
VERSION
- Version 0.20
+ Version 0.24
SYNOPSIS
"reap", "localize", "localize_elem", "localize_delete" and "WORDS" :
* execute a subroutine in the setting of an upper subroutine stack
frame with "uplevel" ;
- * uniquely identify contextes with "uid" and "validate_uid".
+ * uniquely identify contexts with "uid" and "validate_uid".
FUNCTIONS
In all those functions, $context refers to the target scope.
"local *x".
* A string beginning with '@' or '%', for which the call is equivalent
- to respectiveley "local $a[$key]; delete $a[$key]" and "local
+ to respectively "local $a[$key]; delete $a[$key]" and "local
$h{$key}; delete $h{$key}".
* A string beginning with '&', which more or less does "undef &func"
unwind @values, $context;
Returns @values *from* the subroutine, eval or format context pointed by
- or just above $context, and immediately restart the program flow at this
- point - thus effectively returning @values to an upper scope. If @values
- is empty, then the $context parameter is optional and defaults to the
- current context (making the call equivalent to a bare "return;") ;
- otherwise it is mandatory.
+ or just above $context, and immediately restarts the program flow at
+ this point - thus effectively returning @values to an upper scope. If
+ @values is empty, then the $context parameter is optional and defaults
+ to the current context (making the call equivalent to a bare "return;")
+ ; otherwise it is mandatory.
The upper context isn't coerced onto @values, which is hence always
evaluated in list context. This means that
yield @values, $context;
Returns @values *from* the context pointed by or just above $context,
- and immediately restart the program flow at this point. If @values is
+ and immediately restarts the program flow at this point. If @values is
empty, then the $context parameter is optional and defaults to the
current context ; otherwise it is mandatory.
Immediately returns @values from the current block, whatever it may be
(besides a "s///e" substitution context). "leave" is actually a synonym
- for "unwind HERE", while "leave @values" is a synonym for "yield
- @values, HERE".
+ for "yield HERE", while "leave @values" is a synonym for "yield @values,
+ HERE".
Like for "yield", you can use the fifth value returned by "context_info"
to handle context coercion.
and format contexts. When $context is omitted, it defaults to the
current context.
- The values returned are, in order :
+ The returned values are, in order :
* *(index 0)* : the namespace in use when the context was created ;
Getting a context from a context
For any of those functions, $from is expected to be a context. When
- omitted, it defaults to the the current context.
+ omitted, it defaults to the current context.
"UP"
my $upper_context = UP;
Moreover, in order to handle "goto" statements properly, "uplevel"
currently has to suffer a run-time overhead proportional to the size of
- the the callback in every case (with a small ratio), and proportional to
- the size of all the code executed as the result of the "uplevel" call
+ the callback in every case (with a small ratio), and proportional to the
+ size of all the code executed as the result of the "uplevel" call
(including subroutine calls inside the callback) when a "goto" statement
is found in the "uplevel" callback. Despite this shortcoming, this XS
version of "uplevel" should still run way faster than the pure-Perl
version from Sub::Uplevel.
DEPENDENCIES
- perl 5.6.
+ perl 5.6.1.
A C compiler. This module may happen to build with a C++ compiler as
well, but don't rely on it, as no guarantee is made in this regard.
- XSLoader (core since perl 5.006).
+ XSLoader (core since perl 5.6.0).
SEE ALSO
"local" in perlfunc, "Temporary Values via local()" in perlsub.
Thanks to Shawn M. Moore for motivation.
COPYRIGHT & LICENSE
- Copyright 2008,2009,2010,2011,2012 Vincent Pit, all rights reserved.
+ Copyright 2008,2009,2010,2011,2012,2013 Vincent Pit, all rights
+ reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.