Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Which modules should I be using to write modern Perl?

by crumbly (Sexton)
on Jun 16, 2009 at 04:26 UTC ( #771871=perlquestion: print w/replies, xml ) Need Help??

crumbly has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

Getting back into Perl recently (it's been a couple of years), and I'd like to make sure I'm writing it in as modern a fashion as possible. Which modules should I be using at the top of most of my files?

So far, aside from strict and warnings, the (albeit short) list I have (used as-needed, of course) is something like:

  • Moose
  • Perl6::Slurp
  • List::Utils
  • List::MoreUtils

I've also been getting familiar with:

  • MooseX::Declare
  • Modern::Perl

What else would you recommend? Is there a site anywhere that lists and ranks the most recommended modern Perl 5 modules? That would excellent.

Thanks!

  • Comment on Which modules should I be using to write modern Perl?

Replies are listed 'Best First'.
Re: Which modules should I be using to write modern Perl?
by Your Mother (Bishop) on Jun 16, 2009 at 04:57 UTC

    I find these becoming increasingly indisposable -- Path::Class, DateTime, JSON::XS, Template::Alloy, DBIx::Class or Rose::DB; Test::Class. To some degree you can begin to look after authors and see either what they are writing writing or preferring. If Dave Rolsky, Yuval Kogman, or Adam Kennedy--and plenty of others, they just jump to mind--write, use in their code, or recommend something, you should at least check it out. No one bats 1_000 but those cats come close.

    The ones you mention are good baselines. The ones I find best practices for modern code are not necessarily wonderful things like like List::Util (note, no "s") but things like DateTime which seem like more/too-much work up front sometimes but save your @$$ when your code explodes or features creep. One of the main advantages of using code like this is it steers your design. When you have well designed OO code you can't jury-rig/wing-it as much. You are forced to be more disciplined by the tools.

    Update: Perl 5 Wiki: Recommended CPAN Modules.

    Update 2: I'm going to also mention URI and say that this site and the external journals of some of its members are probably the best thing you can do to get back into Perl in a way that will make you happy. Many of the users here give gospel as much as advice. I really believe a year at PM paying attention and participating is worth more than some degrees and certificates.

      Thanks for the recommendations, and for that link to the Perl 5 wiki. Very useful.

Re: Which modules should I be using to write modern Perl?
by perrin (Chancellor) on Jun 16, 2009 at 13:07 UTC

    There's not very much agreement on this. For example, I wouldn't touch Modern::Perl because I don't want to get involved with alternative method resolution systems like C3.

    I typically want exceptions, in the form of Exception::Class, and parameter checking, in the form of Params::Validate. The actual modules used are not very important though -- it's validating params and using exceptions that's important.

Re: Which modules should I be using to write modern Perl?
by bruno (Friar) on Jun 16, 2009 at 16:58 UTC

      Ah. Thanks for that link to Task::Kensho -- I wouldn't have easily found it by browsing the EPO website.

      Also, the modules it lists have a lot in common with what's recommended on the Perl 5 wiki. Putting the two together, and poking around a bit more, I think I've got a good list.

Re: Which modules should I be using to write modern Perl?
by Unforgiven (Hermit) on Jun 17, 2009 at 13:37 UTC
    Another handy thing, although it might not the sort of module you had in mind, is perlcritic.
Re: Which modules should I be using to write modern Perl?
by JavaFan (Canon) on Jun 17, 2009 at 14:02 UTC
    strict.pm has been around longer than Netscape version 1. Targeting "Netscape 1" for webpages certainly isn't "modern web programming". By the same means, "strict" isn't "modern Perl". It's been around for quite a while.

      But the "best practice of using strict" has been around slightly less long... Modern Perl != modern modules (necessarily)


      The zeroeth step in writing a module is to make sure that there isn't already a decent one in CPAN. (-- Pod::Simple::Subclassing)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://771871]
Approved by GrandFather
Front-paged by jdporter
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2019-10-19 14:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?