The birth of new modules for the Perl scripting language is a regular occurrence, and the publication of an O'Reilly book about one of these modules is a sign of coming of age. Perl's DBI module, which facilitates the database-independent operation of Perl, achieves its rite of passage this month with the arrival of Alligator Descartes and Tim Bunce's excellent Programming Perl's DBI
. Perl's DBI interface is maintained by Bunce and includes submodule interfaces to Oracle, MySQL, Sybase, Microsoft ODBC, and many other smaller databases. O'Reilly Perl book aficionados take note: this is the cheetah book, named for the animal that graces its cover.
Far from being a formalized how-to or man page, Programming Perl's DBI is a mini textbook in database programming, ideal for CPAN-savvy Perl programmers with little or no experience in database programming. Descartes and Bunce develop primitive notions of databases by using flat files, and they introduce relational databases with careful didactic motivation. The example database used throughout the book contains ancient sacred monolithic sites in the UK and elsewhere, of which Stonehenge is the most famous. Readers will learn about these primitive places while storing, updating, deleting, sorting, and locking their descriptors using flat files, nonrelational and relational databases, and a tutorial on SQL. The last chapters describe the peculiarities of interacting with ODBC and introduce DBI's Perl-less diagnostic shell and database proxying.
The authors use many modules--including DBI itself--that are not part of the vanilla Perl distribution, and Descartes and Bunce introduce them without explaining where to find or build them. Perl newbies with no CPAN experience may find themselves derailed early. The Storage module seems not to be available on CPAN at all (at the time of this writing). Fortunately, DBI and friends build, test, and install seamlessly under Linux/Red Hat 6.1.
At 350 pages, Programming the Perl DBI is 60 percent text--filled with highly annotated Perl code--and 40 percent appendices covering a detailed specification of DBI and 3-to-5-page descriptions of each of the 14 supported databases. Brevity is a large component of this book's wit. Clarity is the rest of it. --Peter Leopold
'The book is very well written with frequent examples. It certainly maintained my interest from beginning to end. I mirrored the authors' examples with my own MySQL databases and had no problems. I learnt SQL as well. If you need to interact with databases and you have access to Perl, then this book is a must.' - Mick Farmer, news@UK, June 2000