On 20/09/2011 15:57, Randal L. Schwartz wrote:
"Rob" == Rob Dixon<[email protected]> writes:Rob> For me, the bottom line is that try / catch is a funky showpiece that Rob> pushes Perl syntax beyond its limits. No one who sees your code will Rob> thank you for using it, and you should remove it in preference of a Rob> simple check on $@. Completely disagree. Checking $@ *appears* to be easy, but is prone to error. Try::Tiny is best of breed to fix this. I would prefer people use Try::Tiny instead of trying to handcraft the $@ checking and getting it wrong. For example, if you don't know what's wrong with this: eval { ... }; if ($@) { ... } then you *need* to start using Try::Tiny. See especially the section beginning "BACKGROUND" on the Try::Tiny manpage.
I don't have Try::Tiny installed, but will take a look. If you mean that $@ may be accessed by several pieces of code when a program dies, then I agree, but my main concern is that try / catch are both simply prototyped subroutines, and the compile can not tie things down to requiring try BLOCK catch BLOCK; Maybe Try::Tiny works differently but I can't see how it could cover this. Rob -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
