1Scope::Upper(3)       User Contributed Perl Documentation      Scope::Upper(3)
2
3
4

NAME

6       Scope::Upper - Act on upper scopes.
7

VERSION

9       Version 0.32
10

SYNOPSIS

12       "reap", "localize", "localize_elem", "localize_delete" and "WORDS" :
13
14           package Scope;
15
16           use Scope::Upper qw<
17            reap localize localize_elem localize_delete
18            :words
19           >;
20
21           sub new {
22            my ($class, $name) = @_;
23
24            localize '$tag' => bless({ name => $name }, $class) => UP;
25
26            reap { print Scope->tag->name, ": end\n" } UP;
27           }
28
29           # Get the tag stored in the caller namespace
30           sub tag {
31            my $l   = 0;
32            my $pkg = __PACKAGE__;
33            $pkg    = caller $l++ while $pkg eq __PACKAGE__;
34
35            no strict 'refs';
36            ${$pkg . '::tag'};
37           }
38
39           sub name { shift->{name} }
40
41           # Locally capture warnings and reprint them with the name prefixed
42           sub catch {
43            localize_elem '%SIG', '__WARN__' => sub {
44             print Scope->tag->name, ': ', @_;
45            } => UP;
46           }
47
48           # Locally clear @INC
49           sub private {
50            for (reverse 0 .. $#INC) {
51             # First UP is the for loop, second is the sub boundary
52             localize_delete '@INC', $_ => UP UP;
53            }
54           }
55
56           ...
57
58           package UserLand;
59
60           {
61            Scope->new("top");    # initializes $UserLand::tag
62
63            {
64             Scope->catch;
65             my $one = 1 + undef; # prints "top: Use of uninitialized value..."
66
67             {
68              Scope->private;
69              eval { require Cwd };
70              print $@;           # prints "Can't locate Cwd.pm in @INC
71             }                    #         (@INC contains:) at..."
72
73             require Cwd;         # loads Cwd.pm
74            }
75
76           }                      # prints "top: done"
77
78       "unwind" and "want_at" :
79
80           package Try;
81
82           use Scope::Upper qw<unwind want_at :words>;
83
84           sub try (&) {
85            my @result = shift->();
86            my $cx = SUB UP; # Point to the sub above this one
87            unwind +(want_at($cx) ? @result : scalar @result) => $cx;
88           }
89
90           ...
91
92           sub zap {
93            try {
94             my @things = qw<a b c>;
95             return @things; # returns to try() and then outside zap()
96             # not reached
97            };
98            # not reached
99           }
100
101           my @stuff = zap(); # @stuff contains qw<a b c>
102           my $stuff = zap(); # $stuff contains 3
103
104       "uplevel" :
105
106           package Uplevel;
107
108           use Scope::Upper qw<uplevel CALLER>;
109
110           sub target {
111            faker(@_);
112           }
113
114           sub faker {
115            uplevel {
116             my $sub = (caller 0)[3];
117             print "$_[0] from $sub()";
118            } @_ => CALLER(1);
119           }
120
121           target('hello'); # "hello from Uplevel::target()"
122
123       "uid" and "validate_uid" :
124
125           use Scope::Upper qw<uid validate_uid>;
126
127           my $uid;
128
129           {
130            $uid = uid();
131            {
132             if ($uid eq uid(UP)) { # yes
133              ...
134             }
135             if (validate_uid($uid)) { # yes
136              ...
137             }
138            }
139           }
140
141           if (validate_uid($uid)) { # no
142            ...
143           }
144

DESCRIPTION

146       This module lets you defer actions at run-time that will take place
147       when the control flow returns into an upper scope.  Currently, you can:
148
149       ·   hook an upper scope end with "reap" ;
150
151       ·   localize variables, array/hash values or deletions of elements in
152           higher contexts with respectively "localize", "localize_elem" and
153           "localize_delete" ;
154
155       ·   return values immediately to an upper level with "unwind", "yield"
156           and "leave" ;
157
158       ·   gather information about an upper context with "want_at" and
159           "context_info" ;
160
161       ·   execute a subroutine in the setting of an upper subroutine stack
162           frame with "uplevel" ;
163
164       ·   uniquely identify contexts with "uid" and "validate_uid".
165

FUNCTIONS

167       In all those functions, $context refers to the target scope.
168
169       You have to use one or a combination of "WORDS" to build the $context
170       passed to these functions.  This is needed in order to ensure that the
171       module still works when your program is ran in the debugger.  The only
172       thing you can assume is that it is an absolute indicator of the frame,
173       which means that you can safely store it at some point and use it when
174       needed, and it will still denote the original scope.
175
176   "reap"
177           reap { ... };
178           reap { ... } $context;
179           &reap($callback, $context);
180
181       Adds a destructor that calls $callback (in void context) when the upper
182       scope represented by $context ends.
183
184   "localize"
185           localize $what, $value;
186           localize $what, $value, $context;
187
188       Introduces a "local" delayed to the time of first return into the upper
189       scope denoted by $context.  $what can be :
190
191       ·   A glob, in which case $value can either be a glob or a reference.
192           "localize" follows then the same syntax as "local *x = $value".
193           For example, if $value is a scalar reference, then the "SCALAR"
194           slot of the glob will be set to $$value - just like "local *x = \1"
195           sets $x to 1.
196
197       ·   A string beginning with a sigil, representing the symbol to
198           localize and to assign to.  If the sigil is '$', "localize" follows
199           the same syntax as "local $x = $value", i.e. $value isn't
200           dereferenced.  For example,
201
202               localize '$x', \'foo' => HERE;
203
204           will set $x to a reference to the string 'foo'.  Other sigils ('@',
205           '%', '&' and '*') require $value to be a reference of the
206           corresponding type.
207
208           When the symbol is given by a string, it is resolved when the
209           actual localization takes place and not when "localize" is called.
210           Thus, if the symbol name is not qualified, it will refer to the
211           variable in the package where the localization actually takes place
212           and not in the one where the "localize" call was compiled.  For
213           example,
214
215               {
216                package Scope;
217                sub new { localize '$tag', $_[0] => UP }
218               }
219
220               {
221                package Tool;
222                {
223                 Scope->new;
224                 ...
225                }
226               }
227
228           will localize $Tool::tag and not $Scope::tag.  If you want the
229           other behaviour, you just have to specify $what as a glob or a
230           qualified name.
231
232           Note that if $what is a string denoting a variable that wasn't
233           declared beforehand, the relevant slot will be vivified as needed
234           and won't be deleted from the glob when the localization ends.
235           This situation never arises with "local" because it only compiles
236           when the localized variable is already declared.  Although I
237           believe it shouldn't be a problem as glob slots definedness is
238           pretty much an implementation detail, this behaviour may change in
239           the future if proved harmful.
240
241   "localize_elem"
242           localize_elem $what, $key, $value;
243           localize_elem $what, $key, $value, $context;
244
245       Introduces a "local $what[$key] = $value" or "local $what{$key} =
246       $value" delayed to the time of first return into the upper scope
247       denoted by $context.  Unlike "localize", $what must be a string and the
248       type of localization is inferred from its sigil.  The two only valid
249       types are array and hash ; for anything besides those, "localize_elem"
250       will throw an exception.  $key is either an array index or a hash key,
251       depending of which kind of variable you localize.
252
253       If $what is a string pointing to an undeclared variable, the variable
254       will be vivified as soon as the localization occurs and emptied when it
255       ends, although it will still exist in its glob.
256
257   "localize_delete"
258           localize_delete $what, $key;
259           localize_delete $what, $key, $context;
260
261       Introduces the deletion of a variable or an array/hash element delayed
262       to the time of first return into the upper scope denoted by $context.
263       $what can be:
264
265       ·   A glob, in which case $key is ignored and the call is equivalent to
266           "local *x".
267
268       ·   A string beginning with '@' or '%', for which the call is
269           equivalent to respectively "local $a[$key]; delete $a[$key]" and
270           "local $h{$key}; delete $h{$key}".
271
272       ·   A string beginning with '&', which more or less does "undef &func"
273           in the upper scope.  It's actually more powerful, as &func won't
274           even "exists" anymore.  $key is ignored.
275
276   "unwind"
277           unwind;
278           unwind @values, $context;
279
280       Returns @values from the subroutine, eval or format context pointed by
281       or just above $context, and immediately restarts the program flow at
282       this point - thus effectively returning @values to an upper scope.  If
283       @values is empty, then the $context parameter is optional and defaults
284       to the current context (making the call equivalent to a bare "return;")
285       ; otherwise it is mandatory.
286
287       The upper context isn't coerced onto @values, which is hence always
288       evaluated in list context.  This means that
289
290           my $num = sub {
291            my @a = ('a' .. 'z');
292            unwind @a => HERE;
293            # not reached
294           }->();
295
296       will set $num to 'z'.  You can use "want_at" to handle these cases.
297
298   "yield"
299           yield;
300           yield @values, $context;
301
302       Returns @values from the context pointed by or just above $context, and
303       immediately restarts the program flow at this point.  If @values is
304       empty, then the $context parameter is optional and defaults to the
305       current context ; otherwise it is mandatory.
306
307       "yield" differs from "unwind" in that it can target any upper scope
308       (besides a "s///e" substitution context) and not necessarily a sub, an
309       eval or a format.  Hence you can use it to return values from a "do" or
310       a "map" block :
311
312           my $now = do {
313            local $@;
314            eval { require Time::HiRes } or yield time() => HERE;
315            Time::HiRes::time();
316           };
317
318           my @uniq = map {
319            yield if $seen{$_}++; # returns the empty list from the block
320            ...
321           } @things;
322
323       Like for "unwind", the upper context isn't coerced onto @values.  You
324       can use the fifth value returned by "context_info" to handle context
325       coercion.
326
327   "leave"
328           leave;
329           leave @values;
330
331       Immediately returns @values from the current block, whatever it may be
332       (besides a "s///e" substitution context).  "leave" is actually a
333       synonym for "yield HERE", while "leave @values" is a synonym for "yield
334       @values, HERE".
335
336       Like for "yield", you can use the fifth value returned by
337       "context_info" to handle context coercion.
338
339   "want_at"
340           my $want = want_at;
341           my $want = want_at $context;
342
343       Like "wantarray" in perlfunc, but for the subroutine, eval or format
344       context located at or just above $context.
345
346       It can be used to revise the example showed in "unwind" :
347
348           my $num = sub {
349            my @a = ('a' .. 'z');
350            unwind +(want_at(HERE) ? @a : scalar @a) => HERE;
351            # not reached
352           }->();
353
354       will rightfully set $num to 26.
355
356   "context_info"
357           my ($package, $filename, $line, $subroutine, $hasargs,
358               $wantarray, $evaltext, $is_require, $hints, $bitmask,
359               $hinthash) = context_info $context;
360
361       Gives information about the context denoted by $context, akin to what
362       "caller" in perlfunc provides but not limited only to subroutine, eval
363       and format contexts.  When $context is omitted, it defaults to the
364       current context.
365
366       The returned values are, in order :
367
368       ·   (index 0) : the namespace in use when the context was created ;
369
370       ·   (index 1) : the name of the file at the point where the context was
371           created ;
372
373       ·   (index 2) : the line number at the point where the context was
374           created ;
375
376       ·   (index 3) : the name of the subroutine called for this context, or
377           "undef" if this is not a subroutine context ;
378
379       ·   (index 4) : a boolean indicating whether a new instance of @_ was
380           set up for this context, or "undef" if this is not a subroutine
381           context ;
382
383       ·   (index 5) : the context (in the sense of "wantarray" in perlfunc)
384           in which the context (in our sense) is executed ;
385
386       ·   (index 6) : the contents of the string being compiled for this
387           context, or "undef" if this is not an eval context ;
388
389       ·   (index 7) : a boolean indicating whether this eval context was
390           created by "require", or "undef" if this is not an eval context ;
391
392       ·   (index 8) : the value of the lexical hints in use when the context
393           was created ;
394
395       ·   (index 9) : a bit string representing the warnings in use when the
396           context was created ;
397
398       ·   (index 10) : a reference to the lexical hints hash in use when the
399           context was created (only on perl 5.10 or greater).
400
401   "uplevel"
402           my @ret = uplevel { ...; return @ret };
403           my @ret = uplevel { my @args = @_; ...; return @ret } @args, $context;
404           my @ret = &uplevel($callback, @args, $context);
405
406       Executes the code reference $callback with arguments @args as if it
407       were located at the subroutine stack frame pointed by $context,
408       effectively fooling "caller" and "die" into believing that the call
409       actually happened higher in the stack.  The code is executed in the
410       context of the "uplevel" call, and what it returns is returned as-is by
411       "uplevel".
412
413           sub target {
414            faker(@_);
415           }
416
417           sub faker {
418            uplevel {
419             map { 1 / $_ } @_;
420            } @_ => CALLER(1);
421           }
422
423           my @inverses = target(1, 2, 4); # @inverses contains (0, 0.5, 0.25)
424           my $count    = target(1, 2, 4); # $count is 3
425
426       Note that if @args is empty, then the $context parameter is optional
427       and defaults to the current context ; otherwise it is mandatory.
428
429       Sub::Uplevel also implements a pure-Perl version of "uplevel".  Both
430       are identical, with the following caveats :
431
432       ·   The Sub::Uplevel implementation of "uplevel" may execute a code
433           reference in the context of any upper stack frame.  The
434           Scope::Upper version can only uplevel to a subroutine stack frame,
435           and will croak if you try to target an "eval" or a format.
436
437       ·   Exceptions thrown from the code called by this version of "uplevel"
438           will not be caught by "eval" blocks between the target frame and
439           the uplevel call, while they will for Sub::Uplevel's version.  This
440           means that :
441
442               eval {
443                sub {
444                 local $@;
445                 eval {
446                  sub {
447                   uplevel { die 'wut' } CALLER(2); # for Scope::Upper
448                   # uplevel(3, sub { die 'wut' })  # for Sub::Uplevel
449                  }->();
450                 };
451                 print "inner block: $@";
452                 $@ and exit;
453                }->();
454               };
455               print "outer block: $@";
456
457           will print "inner block: wut..." with Sub::Uplevel and "outer
458           block: wut..." with Scope::Upper.
459
460       ·   Sub::Uplevel globally overrides the Perl keyword "caller", while
461           Scope::Upper does not.
462
463       A simple wrapper lets you mimic the interface of "uplevel" in
464       Sub::Uplevel :
465
466           use Scope::Upper;
467
468           sub uplevel {
469            my $frame = shift;
470            my $code  = shift;
471            my $cxt   = Scope::Upper::CALLER($frame);
472            &Scope::Upper::uplevel($code => @_ => $cxt);
473           }
474
475       Albeit the three exceptions listed above, it passes all the tests of
476       Sub::Uplevel.
477
478   "uid"
479           my $uid = uid;
480           my $uid = uid $context;
481
482       Returns an unique identifier (UID) for the context (or dynamic scope)
483       pointed by $context, or for the current context if $context is omitted.
484       This UID will only be valid for the life time of the context it
485       represents, and another UID will be generated next time the same scope
486       is executed.
487
488           my $uid;
489
490           {
491            $uid = uid;
492            if ($uid eq uid()) { # yes, this is the same context
493             ...
494            }
495            {
496             if ($uid eq uid()) { # no, we are one scope below
497              ...
498             }
499             if ($uid eq uid(UP)) { # yes, UP points to the same scope as $uid
500              ...
501             }
502            }
503           }
504
505           # $uid is now invalid
506
507           {
508            if ($uid eq uid()) { # no, this is another block
509             ...
510            }
511           }
512
513       For example, each loop iteration gets its own UID :
514
515           my %uids;
516
517           for (1 .. 5) {
518            my $uid = uid;
519            $uids{$uid} = $_;
520           }
521
522           # %uids has 5 entries
523
524       The UIDs are not guaranteed to be numbers, so you must use the "eq"
525       operator to compare them.
526
527       To check whether a given UID is valid, you can use the "validate_uid"
528       function.
529
530   "validate_uid"
531           my $is_valid = validate_uid $uid;
532
533       Returns true if and only if $uid is the UID of a currently valid
534       context (that is, it designates a scope that is higher than the current
535       one in the call stack).
536
537           my $uid;
538
539           {
540            $uid = uid();
541            if (validate_uid($uid)) { # yes
542             ...
543            }
544            {
545             if (validate_uid($uid)) { # yes
546              ...
547             }
548            }
549           }
550
551           if (validate_uid($uid)) { # no
552            ...
553           }
554

CONSTANTS

556   "SU_THREADSAFE"
557       True iff the module could have been built when thread-safety features.
558

WORDS

560   Constants
561       "TOP"
562
563           my $top_context = TOP;
564
565       Returns the context that currently represents the highest scope.
566
567       "HERE"
568
569           my $current_context = HERE;
570
571       The context of the current scope.
572
573   Getting a context from a context
574       For any of those functions, $from is expected to be a context.  When
575       omitted, it defaults to the current context.
576
577       "UP"
578
579           my $upper_context = UP;
580           my $upper_context = UP $from;
581
582       The context of the scope just above $from.  If $from points to the top-
583       level scope in the current stack, then a warning is emitted and $from
584       is returned (see "DIAGNOSTICS" for details).
585
586       "SUB"
587
588           my $sub_context = SUB;
589           my $sub_context = SUB $from;
590
591       The context of the closest subroutine above $from.  If $from already
592       designates a subroutine context, then it is returned as-is ; hence "SUB
593       SUB == SUB".  If no subroutine context is present in the call stack,
594       then a warning is emitted and the current context is returned (see
595       "DIAGNOSTICS" for details).
596
597       "EVAL"
598
599           my $eval_context = EVAL;
600           my $eval_context = EVAL $from;
601
602       The context of the closest eval above $from.  If $from already
603       designates an eval context, then it is returned as-is ; hence "EVAL
604       EVAL == EVAL".  If no eval context is present in the call stack, then a
605       warning is emitted and the current context is returned (see
606       "DIAGNOSTICS" for details).
607
608   Getting a context from a level
609       Here, $level should denote a number of scopes above the current one.
610       When omitted, it defaults to 0 and those functions return the same
611       context as "HERE".
612
613       "SCOPE"
614
615           my $context = SCOPE;
616           my $context = SCOPE $level;
617
618       The $level-th upper context, regardless of its type.  If $level points
619       above the top-level scope in the current stack, then a warning is
620       emitted and the top-level context is returned (see "DIAGNOSTICS" for
621       details).
622
623       "CALLER"
624
625           my $context = CALLER;
626           my $context = CALLER $level;
627
628       The context of the $level-th upper subroutine/eval/format.  It kind of
629       corresponds to the context represented by "caller $level", but while
630       e.g. "caller 0" refers to the caller context, "CALLER 0" will refer to
631       the top scope in the current context.  If $level points above the top-
632       level scope in the current stack, then a warning is emitted and the
633       top-level context is returned (see "DIAGNOSTICS" for details).
634
635   Examples
636       Where "reap" fires depending on the $cxt :
637
638           sub {
639            eval {
640             sub {
641              {
642               reap \&cleanup => $cxt;
643               ...
644              }     # $cxt = SCOPE(0) = HERE
645              ...
646             }->(); # $cxt = SCOPE(1) = UP = SUB = CALLER(0)
647             ...
648            };      # $cxt = SCOPE(2) = UP UP =  UP SUB = EVAL = CALLER(1)
649            ...
650           }->();   # $cxt = SCOPE(3) = SUB UP SUB = SUB EVAL = CALLER(2)
651           ...
652
653       Where "localize", "localize_elem" and "localize_delete" act depending
654       on the $cxt :
655
656           sub {
657            eval {
658             sub {
659              {
660               localize '$x' => 1 => $cxt;
661               # $cxt = SCOPE(0) = HERE
662               ...
663              }
664              # $cxt = SCOPE(1) = UP = SUB = CALLER(0)
665              ...
666             }->();
667             # $cxt = SCOPE(2) = UP UP = UP SUB = EVAL = CALLER(1)
668             ...
669            };
670            # $cxt = SCOPE(3) = SUB UP SUB = SUB EVAL = CALLER(2)
671            ...
672           }->();
673           # $cxt = SCOPE(4), UP SUB UP SUB = UP SUB EVAL = UP CALLER(2) = TOP
674           ...
675
676       Where "unwind", "yield", "want_at", "context_info" and "uplevel" point
677       to depending on the $cxt:
678
679           sub {
680            eval {
681             sub {
682              {
683               unwind @things => $cxt;   # or yield @things => $cxt
684                                         # or uplevel { ... } $cxt
685               ...
686              }
687              ...
688             }->(); # $cxt = SCOPE(0) = SCOPE(1) = HERE = UP = SUB = CALLER(0)
689             ...
690            };      # $cxt = SCOPE(2) = UP UP = UP SUB = EVAL = CALLER(1) (*)
691            ...
692           }->();   # $cxt = SCOPE(3) = SUB UP SUB = SUB EVAL = CALLER(2)
693           ...
694
695           # (*) Note that uplevel() will croak if you pass that scope frame,
696           #     because it cannot target eval scopes.
697

DIAGNOSTICS

699   "Cannot target a scope outside of the current stack"
700       This warning is emitted when "UP", "SCOPE" or "CALLER" end up pointing
701       to a context that is above the top-level context of the current stack.
702       It indicates that you tried to go higher than the main scope, or to
703       point across a "DESTROY" method, a signal handler, an overloaded or
704       tied method call, a "require" statement or a "sort" callback.  In this
705       case, the resulting context is the highest reachable one.
706
707   "No targetable %s scope in the current stack"
708       This warning is emitted when you ask for an "EVAL" or "SUB" context and
709       no such scope can be found in the call stack.  The resulting context is
710       the current one.
711

EXPORT

713       The functions "reap", "localize", "localize_elem", "localize_delete",
714       "unwind", "yield", "leave", "want_at", "context_info" and "uplevel" are
715       only exported on request, either individually or by the tags ':funcs'
716       and ':all'.
717
718       The constant "SU_THREADSAFE" is also only exported on request,
719       individually or by the tags ':consts' and ':all'.
720
721       Same goes for the words "TOP", "HERE", "UP", "SUB", "EVAL", "SCOPE" and
722       "CALLER" that are only exported on request, individually or by the tags
723       ':words' and ':all'.
724

CAVEATS

726       It is not possible to act upon a scope that belongs to another perl
727       'stack', i.e. to target a scope across a "DESTROY" method, a signal
728       handler, an overloaded or tied method call, a "require" statement or a
729       "sort" callback.
730
731       Be careful that local variables are restored in the reverse order in
732       which they were localized.  Consider those examples:
733
734           local $x = 0;
735           {
736            reap sub { print $x } => HERE;
737            local $x = 1;
738            ...
739           }
740           # prints '0'
741           ...
742           {
743            local $x = 1;
744            reap sub { $x = 2 } => HERE;
745            ...
746           }
747           # $x is 0
748
749       The first case is "solved" by moving the "local" before the "reap", and
750       the second by using "localize" instead of "reap".
751
752       The effects of "reap", "localize" and "localize_elem" can't cross
753       "BEGIN" blocks, hence calling those functions in "import" is deemed to
754       be useless.  This is an hopeless case because "BEGIN" blocks are
755       executed once while localizing constructs should do their job at each
756       run.  However, it's possible to hook the end of the current scope
757       compilation with B::Hooks::EndOfScope.
758
759       Some rare oddities may still happen when running inside the debugger.
760       It may help to use a perl higher than 5.8.9 or 5.10.0, as they contain
761       some context-related fixes.
762
763       Calling "goto" to replace an "uplevel"'d code frame does not work :
764
765       ·   for a "perl" older than the 5.8 series ;
766
767       ·   for a "DEBUGGING" "perl" run with debugging flags set (as in "perl
768           -D ...") ;
769
770       ·   when the runloop callback is replaced by another module.
771
772       In those three cases, "uplevel" will look for a "goto &sub" statement
773       in its callback and, if there is one, throw an exception before
774       executing the code.
775
776       Moreover, in order to handle "goto" statements properly, "uplevel"
777       currently has to suffer a run-time overhead proportional to the size of
778       the callback in every case (with a small ratio), and proportional to
779       the size of all the code executed as the result of the "uplevel" call
780       (including subroutine calls inside the callback) when a "goto"
781       statement is found in the "uplevel" callback.  Despite this
782       shortcoming, this XS version of "uplevel" should still run way faster
783       than the pure-Perl version from Sub::Uplevel.
784
785       Starting from "perl" 5.19.4, it is unfortunately no longer possible to
786       reliably throw exceptions from "uplevel"'d code while the debugger is
787       in use.  This may be solved in a future version depending on how the
788       core evolves.
789

DEPENDENCIES

791       perl 5.6.1.
792
793       A C compiler.  This module may happen to build with a C++ compiler as
794       well, but don't rely on it, as no guarantee is made in this regard.
795
796       XSLoader (core since perl 5.6.0).
797

SEE ALSO

799       "local" in perlfunc, "Temporary Values via local()" in perlsub.
800
801       Alias, Hook::Scope, Scope::Guard, Guard.
802
803       Sub::Uplevel.
804
805       Continuation::Escape is a thin wrapper around Scope::Upper that gives
806       you a continuation passing style interface to "unwind".  It's easier to
807       use, but it requires you to have control over the scope where you want
808       to return.
809
810       Scope::Escape.
811

AUTHOR

813       Vincent Pit "<vpit at cpan.org>".
814
815       You can contact me by mail or on "irc.perl.org" (vincent).
816

BUGS

818       Please report any bugs or feature requests to "bug-scope-upper at
819       rt.cpan.org", or through the web interface at
820       <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Scope-Upper>.  I will
821       be notified, and then you'll automatically be notified of progress on
822       your bug as I make changes.
823

SUPPORT

825       You can find documentation for this module with the perldoc command.
826
827           perldoc Scope::Upper
828

ACKNOWLEDGEMENTS

830       Inspired by Ricardo Signes.
831
832       The reimplementation of a large part of this module for perl 5.24 was
833       provided by David Mitchell.  His work was sponsored by the Perl 5 Core
834       Maintenance Grant from The Perl Foundation.
835
836       Thanks to Shawn M. Moore for motivation.
837
839       Copyright 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019
840       Vincent Pit, all rights reserved.
841
842       This program is free software; you can redistribute it and/or modify it
843       under the same terms as Perl itself.
844
845
846
847perl v5.30.0                      2019-07-26                   Scope::Upper(3)
Impressum