http://www.perlmonks.org?node_id=607900

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

Fellow monks, I have a confession. While I've used Perl for years and am relative experienced with databases, I've never actually used Perl to handle database processing.

I'm sick of TCL scripting and would like to use Perl whenever possible, but I don't know much about doing so. I assume DBI is the standard module for queries and such, but what other database access modules have people found useful?

Most importantly, Perl provides many ways to solve a problem, although some are more Perlish than others. What kind of Perlish features do these modules have that programmers of other languages might overlook?


-Ted

Replies are listed 'Best First'.
Re: Database Introduction for Perl Adepts?
by Fletch (Bishop) on Apr 02, 2007 at 19:05 UTC

    Hrmm, kinda open ended question.

    Start with the documentation that ships with DBI. From there check out the ORA book (Programming the Perl DBI, ISBN 0596005865). Between those two you'll be mostly set.

    As for modules, check out things such as Class::DBI and DBIx::Recordset (and I'm sure there's others that people are going to chime in with their favourites).

Re: Database Introduction for Perl Adepts?
by moklevat (Priest) on Apr 02, 2007 at 19:24 UTC
    It may seem like a trite suggestion, but I have found the monastery's Database Programming tutorials to be helpful.
Re: Database Introduction for Perl Adepts?
by Old_Gray_Bear (Bishop) on Apr 02, 2007 at 19:30 UTC
    Take a look at the Tutorials section of the monastery . gmax has several useful and nifty nodes there.

    ----
    I Go Back to Sleep, Now.

    OGB

Re: Database Introduction for Perl Adepts?
by philcrow (Priest) on Apr 02, 2007 at 20:10 UTC
    While DBI is all you really need, we like DBIx::Class, so we can pretend database rows are objects. There are other object relational mappers (ORMs), but we switced to DBIx::Class about 9 months ago and have been happy with it. We still use DBI directly for intricate queries where the ORM seems to get in the way or in the very rare (for us) case where speed is an issue. ORMs do pay a speed penalty by creating objects.

    Phil

Re: Database Introduction for Perl Adepts?
by gloryhack (Deacon) on Apr 02, 2007 at 20:50 UTC
    In addition to the other fine suggestions you've received and may continue to receive, you might find Data::Phrasebook::SQL handy. I've recently begun using it and I just love the darn thing for middleware applications that have to run in environments where the data is similar but the sources unique.

    I don't think I'd bother to incur the overhead in a definite purpose, single installation application, but for those that have to use slightly different SQL to adapt to their target environments, it's very cool.