Note that Try::Tiny doesn't provide more than the "or do" patternIt actually does, it preserves the value of $@, the following modifications to your script demonstrate the difference:
...; eval { die "Foo!" }; # Exception details lost. eval { my $o2 = 'My::Obj'->new; die "Exception!"; 1 } or do { warn "Caught with or: $@"; }; say "\$\@ after eval or do: $@"; # not same as above. use Try::Tiny; eval { die "Foo!" }; try { my $o3 = 'My::Obj'->new; die "Exception!"; } catch { warn "Caught with Try::Tiny: $_"; }; say "\$\@ after try catch: $@";
In reply to Re: Bug in eval in pre-5.14
by zwon
in thread Bug in eval in pre-5.14
by choroba
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |