in reply to Is there a way to unwind the call stack and return a value?

I suspect what you are asking for is to be able to return the point of execution to the state that pertained just before the exception was thrown, but with conditions altered to avoid the throw. You would need a modified die to achieve that which calls error handling at the point of failure and is capable of rerunning the failing statement following the return from the handler.

While such an animal may be possible (most processors handle math exceptions and memory issues that way), it's non-trivial in an arbitrary context and would probably require fiddling with Perl's internals. You would be much better to rethink your error handling to avoid the problem - perhaps by wrapping a sub in an eval block and retrying the sub on error?


Perl is environmentally friendly - it saves trees
  • Comment on Re: Is there a way to unwind the call stack and return a value?