# Immediately return (1, 2, 3) from the sub, bypassing the eval.
$sub->unwind(@values, 3);
# Immediately return (1, 2, 3) from the sub, bypassing the eval.
$sub->unwind(@values, 3);
+
+ # Not reached.
}
}
+
+ # Not reached.
}->();
}->();
+
+ # unwind() returns here. "hello\n" was printed, and now
+ # $SIG{__DIE__} is undefined.
}
=head1 DESCRIPTION
}
=head1 DESCRIPTION
@@ -70,11+77,11 @@ This gives you a prettier and safer interface when you are not reaching for extr
The L<Scope::Context> methods actually do more than their subroutine counterparts from L<Scope::Upper> : before each call, the target context will be checked to ensure it is still active (which means that it is still present in the current call stack), and an exception will be thrown if you attempt to act on a context that has already expired.
This means that :
The L<Scope::Context> methods actually do more than their subroutine counterparts from L<Scope::Upper> : before each call, the target context will be checked to ensure it is still active (which means that it is still present in the current call stack), and an exception will be thrown if you attempt to act on a context that has already expired.
This means that :
- my $sc;
+ my $cxt;
{
{
- $sc = Scope::Context->new;
+ $cxt = Scope::Context->new;
}
}
- $sc->reap(sub { print "hello\n });
+ $cxt->reap(sub { print "hello\n });
will croak when L</reap> is called.
will croak when L</reap> is called.
@@ -241,7+248,7 @@ If omitted, C<$frames> defaults to C<0>, which results in the closest sub enclos
}
sub inner {
}
sub inner {
- my $sub = Scope::Context->new->sub(1); # = Scope::Context->sub
+ my $sub = Scope::Context->new->sub(1); # = Scope::Context->sub(1)