Eric Brine wrote:
>On Mon, Jul 3, 2017 at 11:11 AM, Thomas Klausner <[email protected]> wrote:
>> I personally don't like Try::Tiny, because it changes how 'return' works
>> inside an eval (well, try)
>
>What difference is there?
I think domm is actually thinking of TryCatch there. Inside an eval,
or Try::Tiny's try, a return expression returns from the eval/try.
Inside TryCatch's try, a return expression ignores the try scope and
returns from whatever it would have returned from without it, usually
from the enclosing subroutine.
$ perl -lwe 'sub z { eval { return 123 }; return 456; } print z()'
456
$ perl -MTry::Tiny -lwe 'sub z { try { return 123; }; return 456; } print z()'
456
$ perl -MTryCatch -lwe 'sub z { try { return 123; } return 456; } print z()'
123
-zefram