Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: eval to replace die?

by eyepopslikeamosquito (Chancellor)
on Oct 04, 2010 at 03:36 UTC ( #863236=note: print w/replies, xml ) Need Help??

in reply to eval to replace die?

I doubt that PBP (2005) is up to date with the latest developments in this area. The recently released (2010) 2nd edition of Effective Perl Programming recommends the CPAN Try::Tiny module (released 2009) and the new core autodie pragma (added to perl 5.10.1 in 2009): see items 101 ("Use die to generate exceptions") and 103 ("Handle exceptions properly"). In particular, item 103 summarizes with "handling $@ is tricky, but Try::Tiny does it correctly". Re dependencies etc., the Try::Tiny CPAN ratings look good ("small, zero dependencies, ...").

Replies are listed 'Best First'.
Re^2: eval to replace die?
by hsmyers (Canon) on Oct 04, 2010 at 04:27 UTC

    I like the zero dependencies part. While poking about, I installed TryCatch and wasn't pleased with the more than 400 files that tagged along. Don't think I want to do that to folks using my module. No way to avoid some build up, but minimizing it is bound to be a good thing (™) I also read EPP 2nd and noticed the reference to use autodie; and the other modules— maybe this is the way to go. At least the Try::Tiny option; I'd just as soon avoid dragging anyone into using a more modern Perl unless I have to!


    "Never try to teach a pig to wastes your time and it annoys the pig."

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://863236]
[choroba]: no, just trying to judge a book in the same way
[choroba]: i.e. using it for a totally different purpose than it was written for

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2017-11-17 21:42 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (274 votes). Check out past polls.