Re: Which modules provide highest return-on-investment?by pjf (Curate)
|on Oct 13, 2008 at 04:48 UTC||Need Help??|
The modules I find give me the biggest bang-for-buck are the ones that allow me to avoid learning other, more costly methods of doing the same thing. strict is an obvious example of this, it tells me up-front when I've made a typo in a variable name, rather than me going through a costly debugging process.
In this regard, Moose is a big win, as it means I don't have to learn Perl's somewhat esoteric OO system
The other big bang-for-buck modules for me personally are ones that I've written myself, and which I find myself using in practically every program. IPC::System::Simple means I never have to look at $? again, or find myself wishing Perl would allow backticks without invoking the shell, or wishing that system() really did work the same way on all systems.
All my code these days start with use autodie. Having to write or die... after a call to open, close, chdir, unlink, binmode, rename, mkdir, rmdir, fork, etc etc is a total waste of time for me. Using autodie means not only does leaving out the manual error handling becomes correct, but I end up with nicer looking errors, and a number of esoteric bugs go away (eg, calls to fork and open which can legitimately return zero for success, and undef for failure).
When I move from wanting my program to simply die on error to something more complex to recover from that error, autodie gives me sane upgrade path, since the exceptions it produces contain full information as to which call failed, its argument, location, errno, and other pertinent information.
Since I've just turned this post into a massive advertisement for autodie, I should link to an old video on its usage. The big changes is that autodie now works in 5.8.x (not just 5.10.x), and the exception interface has changed slightly since the beta.
Perl Training Australia