|
NAMELong::Jump - Mechanism for returning to a specific point from a deeply nested stack.DESCRIPTIONThis module essentially provides a multi-level return. You can mark a spot with "setjump()" and then unwind the stack back to that point from any nested stack frame by name using "longjump()". You can also provide a list of return values.This is not quite a match for C's long jump, but it is "close enough". It is safer than C's jump in that it only lets you escape frames by going up the stack, you cannot jump in other ways. SYNOPSISuse Long::Jump qw/setjump longjump/; my $out = setjump foo => sub { bar(); ...; # Will never get here }; is($out, [qw/x y z/], "Got results of the long jump"); $out = setjump foo => sub { print "Not calling longjump"; }; is($out, undef, "longjump was not called so we got an undef response"); sub bar { baz(); return 'bar'; # Will never get here } sub baz { bat(); return 'baz'; # Will never get here } sub bat { my @out = qw/x y z/; longjump foo => @out; return 'bat'; # Will never get here } EXPORTS
SOURCEThe source code repository for Long-Jump can be found at https://github.com/exodist/Long-Jump/.MAINTAINERS
AUTHORS
COPYRIGHTCopyright 2018 Chad Granum <exodist7@gmail.com>.This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/
Visit the GSP FreeBSD Man Page Interface. |