in reply to Continuations in Perl - Returning to an arbitrary level up the call stack

There's Scope::Upper which provides unwind_at that essentially allows you to perform a return higher up the stack.

You could also try Return::MultiLevel which seems to provide a pretty sane interface for continuations, albeit requiring some co-operation between caller and callee. Also take a look at some of MAUKE's other modules that follow on from that.

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Replies are listed 'Best First'.
Re^2: Continuations in Perl - Returning to an arbitrary level up the call stack
by unlinker (Monk) on May 18, 2013 at 21:30 UTC
    Thanks! Return::MultiLevel is exactly what I was looking for.
      > Thanks! Return::MultiLevel is exactly what I was looking for.

      Of course, it uses goto under the hood, just hidden behind massive abstraction and overhead ... 8-|

      Cheers Rolf

      ( addicted to the Perl Programming Language)

      ¹) Unfortunately there is no emoticon for shaking the head and sighing...

        No, I understand that goto won't work with recursion like Return::MultiLevel.
        It's more like setjmp()/longjmp() and implemented using eval EXPR and goto.