Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Essential Perl Modules

by Steve_p (Priest)
on Sep 21, 2002 at 07:54 UTC ( [id://199711]=perlmeditation: print w/replies, xml ) Need Help??

I've been programming with Perl for quite sometime now and find myself constantly refering less experienced Perl programmers to make more use of the core Perl modules. For example, I've had to explain the use of strftime more times in the past month than I can remember.

Despite this, I rarely stray far from the core modules other than to use the various DBI/DBD, XML, and LWP modules. I just haven't needed to step to far from these modules, or so I seem to think. What modules outside the core are essential for you to get your work done an why? Is there some necessary module that you think I've missed?


Replies are listed 'Best First'.
Re: Essential Perl Modules
by blokhead (Monsignor) on Sep 21, 2002 at 08:34 UTC
    Considering the modules you've already listed, it sounds like you're doing at least some web-related/CGI work with Perl. If that's the case, I'd definitely insist on getting intimate with at least one templating system. I use HTML::Template, but I know that Template Toolkit and Text::Template are also among the most popular. Separating layout control from code control is a good paradigm. And if you happen to be collaborating with designers, it also keeps them happy (and out of your code). I finally started into templating about 6 months ago and have never looked back. It's the easiest step you can take to make your CGI applications more maintainable and less ad-hoc. Search around the monastary for 'templating systems' or similar terms -- there a lot of great templating solutions out there, as you'll see, and everyone has his or her favorite.

    For DBI work, I also consider a module such as Class::DBI to be a near-essential. I use a self-rolled equivalent of this module, and it makes interfacing with the data much friendlier. Unless you are doing very complicated database querying, Class::DBI will make coding much faster.

    These are pretty basic modules that even unexperienced Perlers should be able to handle nicely. I've never used Config::General or Parse::RecDescent personally, but I hear other monks bring them up all the time, so you may find these useful as well. These are the only general-purpose modules I can think of off the top of my head, but I'm sure you'll get a ton of additional replies to this good question.


Re: Essential Perl Modules
by adrianh (Chancellor) on Sep 21, 2002 at 10:59 UTC

    The Test:: modules are absolute essentials for me. Never develop without them. Once you get test infected you won't either :-)

    Although Test::More has been core since v5.007003 other useful things like Test::Differences, Test::Exception, etc. are not.

    Other essentials for me include:

    • Template - I like templates. Template Toolkit meets my requirements best.
    • AppConfig - saves me typing and makes all my apps work the same.
    • CGI::Application - saves me code and encourages me to be good
    • DBI - the best DB layer I've come across in any language
    • CPANPLUS - makes automating CPAN installs so much simpler
    • Class::DBI - saves me so much typing when developing DB applications
    • Exception::Class - I like exceptions
    • HTML::Parser - is my friend for messing with HTML


    • 20020922 - made "test infected" a link - thanks ignatz
Re: Essential Perl Modules
by blakem (Monsignor) on Sep 21, 2002 at 10:01 UTC
    It's somewhat dated, but you might be interested in Most Often Mentioned Modules, which shows how many times various modules had been mentioned on perlmonks up to that point.... Perhaps its time to rerun the script and update the tally.


      Very interesting list. I'd like to see it rerun also for trend analysis.
Re: Essential Perl Modules
by Ryszard (Priest) on Sep 21, 2002 at 08:57 UTC
    I guess it depends on what kind of domain your working in as to what you consider an "essential" module.

    I'm doing lots of web based stuff right now, so an essential module is CGI::Application/HTML::Template. I also find Date::Manip great for doing, interestingly enuff, date stuff.

    I too have also rolled my own interface to the DBI, which has become essential to most of the stuff we do in the office.

    We also use Digest::MD5. Its got all sorts of applications, however we use it to generate session id's in our web apps.

    Prolly one of the most heavily used modules is Data::Dumper, (we mainly use it for debugging), but of course that is core.. :-)

Re: Essential Perl Modules
by jordanh (Chaplain) on Sep 21, 2002 at 14:31 UTC
    I'm surprised that nobody has mentioned Simon Cozen's Cozens' 10 modules I wouldn't go anywhere without. The link is to a brief summary by jdavidb over on Use Perl; of a Talk given at last years OS CON.

    I've installed these on my development box and I'm exploring the one's I wasn't already familiar with. Seems like an interesting selection.

    Personally, I'm sold on HTML::TreeBuilder. I haven't used other methods of parsing HTML very much, well except for regular expressions, but I find that processing them as trees is easy and safe.

    Update: 09/22/2002 15:36 EDT I'd forgotten about this Bundle on CPAN. Has all of the modules and the notes from the talk wrapped up neatly.

    Update: 09/24/2002 17:31 - It's Cozens' not Cozen's.

Re: Essential Perl Modules
by kabel (Chaplain) on Sep 21, 2002 at 10:54 UTC
    the one module i like most is the Class::MethodMaker. i consider it one of the most useful modules.

    another basic - in spite of the comments i read here - is the Switch module. i used it in nearly any script i wrote :) it is just cleaner than the workarounds that are well known.

    finally i consider the Tie::File module as "beatiful".
Re: Essential Perl Modules
by vek (Prior) on Sep 21, 2002 at 15:26 UTC
Re: Essential Perl Modules
by George_Sherston (Vicar) on Sep 21, 2002 at 12:48 UTC
    I'm enthusiastic about PDF::Create - obviously quite specialist, but if you need to create PDFs on-the-fly it's a sturdy implement.

    George Sherston
Re: Essential Perl Modules
by gav^ (Curate) on Sep 21, 2002 at 22:49 UTC
    Running: grep -h "^use" *.pl | grep -v -E "constant|strict|warnings|vars" | sort | uniq on the last couple of projects I've worked on gives me the following list of modules:
    Apache::Session::MySQL, CGI, CGI::Carp, Class::DBI, Data::Dump, Data::FormValidator, Digest::MD5, Email::Valid, HTML::Entities, HTML::Parser, HTML::TagFilter, HTML::TreeBuilder, Mail::Sendmail, MIME::Lite, Storable, Template, Text::ParseWords, Time::Piece::MySQL, URI::Escape, YAML
    I'd consider them to be the most useful modules I regularly use.
Re: Essential Perl Modules
by Rudif (Hermit) on Sep 21, 2002 at 18:58 UTC
    Do you need often to walk file directories and do (or not) something with each file?

    Want to save a few keystrokes when reading and writing text files?


Re: Essential Perl Modules
by sauoq (Abbot) on Sep 22, 2002 at 04:17 UTC
Re: Essential Perl Modules
by Zaxo (Archbishop) on Sep 22, 2002 at 00:44 UTC

    PDL is essential to me.

    The Inline family of modules is terrific, particularly the granddaddy, Inline::C. I also get some use from Graph for modeling all sorts of things.

    After Compline,

Re: Essential Perl Modules
by lachoy (Parson) on Sep 22, 2002 at 01:56 UTC
Re: Essential Perl Modules
by PodMaster (Abbot) on Sep 21, 2002 at 22:27 UTC
    Having invented this particular wheel, once upon a time when I first touched perl (okay, the 2nd time, it was the same week ;)), Calendar::Simple. It uses Time::Local, which is also pretty nice.

    ** The Third rule of perl club is a statement of fact: pod is sexy.

Re: Essential Perl Modules
by Abstraction (Friar) on Sep 22, 2002 at 23:02 UTC
Re: Essential Perl Modules
by spartacus9 (Beadle) on Sep 22, 2002 at 17:59 UTC
    Since our team does primarily web-based CGI application development, one essential to our work is CGI::Carp, specifically referring to the "CGI::Carp qw(fatalsToBrowser)" function. Without this module, we would have to constantly tail the web server error logs whenever our scripts had a problem in order to determine the actual cause of the error. With this module in place, the error is immediately output to the browser, along with the appropriate content-type headers.
      Interesting, I perfer to work the other way around. Have a couple of term's open, editing the cgi in one term, and tailing the log in the other term.. ;-)

      I'm lucky enuff where we have an environment, such that each developer has their code sitting on their own port of the same apache server... everything is syncronised via CVS, sweet.

Re: Essential Perl Modules
by Aristotle (Chancellor) on Sep 22, 2002 at 00:02 UTC
    I've only recently ran across DBIx::Librarian and by the looks of it, no larger database-reliant project should be built without a tool like this module.

    Makeshifts last the longest.

Re: Essential Perl Modules
by helgi (Hermit) on Sep 23, 2002 at 12:40 UTC
    I would like to second many of the choices made by other monks. However I would like to recommend a few more that no one else seems to have mentioned:

    Tk - for creating graphical user interfaces.

    GD and GD::Graph - For manipulating graphical objects

    Bioperl - For dealing with DNA sequences.

    Compress::Zlib and its more user friendly daughter Archive::Zip for working with compressed files.

    -- Regards,
    Helgi Briem
    helgi AT decode DOT is

Re: Essential Perl Modules
by kryberg (Pilgrim) on Sep 26, 2002 at 01:02 UTC
    Essential modules depend on what type of programming you do. I do mostly web-based CGI and use:
    CGI::Carp for use CGI::Carp 'fatalsToBrowser'; error messages

    and, I haven't used it yet, but I need to start using

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://199711]
Approved by valdez
Front-paged by grep
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-06-23 06:46 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.