err has asked for the wisdom of the Perl Monks concerning the following question:
Hi there,
I am using Try::Tiny for catching dies in my script. But I've some problems to return from the sub the try..catch - block is in.
Here's some sample:
use Try::Tiny; sub foo { try { die; } catch { print 'error'; return; }; print 'no_err'; } foo;
This code outputs: "errorno_err". So as you can see it does not return from the sub itself, only from the catch block.
Anybody has an idea how to get the desired behavior?
Thank you for help!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Try::Tiny - return in catch from sub
by jethro (Monsignor) on Nov 26, 2010 at 14:03 UTC | |
|
Re: Try::Tiny - return in catch from sub
by mjscott2702 (Pilgrim) on Nov 26, 2010 at 14:06 UTC | |
by Anonymous Monk on Nov 26, 2010 at 15:03 UTC | |
by mjscott2702 (Pilgrim) on Nov 26, 2010 at 15:34 UTC | |
by Anonymous Monk on Nov 27, 2010 at 10:35 UTC | |
|
Re: Try::Tiny - return in catch from sub
by ikegami (Patriarch) on Nov 26, 2010 at 17:28 UTC | |
|
Re: Try::Tiny - return in catch from sub
by JavaFan (Canon) on Nov 26, 2010 at 14:04 UTC |