Programming the Perl DBI - a review

koschei on 2001-10-05T01:40:15

Programming the Perl DBI, by Alligator Descartes & Tim Bunce.

In brief: Great for DBI beginners. Needs to have (or be) a quick reference card for the more experienced user.

Not in brief:

Chapter 1: Introduction: Fairly standard O'Reilly introduction chapter. Tells you what what the book is about is about.

Chapter 2: Basic Non-DBI Databases: At first glance, it is a strange thing to have in a book that's about DBI. However, it does serve as a good explanation of why DBI and relational databases in general are good things. It explains both simple data (scalars) and complex data in flat files (mentions Data::Dumper and Storable).

Mentions file locking, which is a good thing, and then goes on to explain DBM.

It then talks about encapsulating records as objects. Doesn't mention the indirect method invocation ambiguity problems that Damian mentions in OOPerl (p.99). Only a minor problem that.

It then points out the limitations of querying using DBM and goes on to (briefly) talk about MLDBM.

So chapter 2 has basically given the reader a reason for reading on. Which is a good thing.

Chapter 3: SQL and Relational Databases:

I can't fault this chapter. An excellent 22 page precis of SQL.

Chapter 4: Programming with the DBI:

This is part 1 of the meat of the book: How to use DBI. Covers connecting and disconnecting. Then it devotes 8 pages to how to handle errors. It's very lovely and comprehensive.

It then gives pointers on debugging and scalar handling.

To be continued...

Code notes: (reminiscent of the litmus test)

  • File locking with flock() is covered reasonably well.
  • Examples all use -w, but rarely 'use strict;'. On the other hand, the majority of the code is also 'strict-clean'.
  • Examples tend to end in 'exit;' which may cause problems with people who don't read the mod_perl notes on using exit() in mod_perl.