It is possible to throw an exception which is considered false in a boolean contextDon't use
Useif ($@)
unless defined eval { somecode(); 1; }
If a DESTROY method calls eval then an object used within your eval could potentially clobber $@.True, well, I count it as nesting evals.
I am not trying to tell that eval is better than Try::Tiny. I just think that OP might want to temporary change one statement to see how it works with plain eval{}.
For cases when people use nested exceptions try/catch blocks, heavy use Exception handling pattern, heavy use OOP (with descructors), Try::Tiny is much better than eval{} (it's impossible to work with eval actually)
But there are valid cases when people don't need to use Exceptions/OOP in so heavy way. Then it's perfectly valid to simply use eval then. And learning eval gotchas is as hard as learning Try::Tiny gotchas.
In reply to Re^5: Try::Tiny catch block with $_ eq ''
by vsespb
in thread Try::Tiny catch block with $_ eq ''
by dd-b
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |