CGI.pm, a Perl library for writing CGI scripts, delivers elegant solutions for using and updating Web forms. The author, Lincoln Stein, realized the need for a clean and simple way to manage forms and--as a columnist for the
Perl Journal, a scientist at Cold Spring Harbor Laboratory, and a Web-based software author--created that solution. He's (refreshingly) humble about this creative process, explaining that it took him a few steps until he realized the key to this HTML/Perl hybrid: simplicity.
The CGI.pm standard allows the site manager to separate data from its HTML markup for use in CGI forms. For example, all the elements in a short drop-down menu of vegetables can be placed in one array, changing this:
peas broccoli cabbage to this:
li(['peas','broccoli,'cabbage'])
to be used later throughout a Perl script.
The
Official Guide to Programming with CGI.pm is geared toward a reader who is familar enough with Perl to have used modules and knowledgeable about HTML and Web-site design. Stein uses CGI.pm for tables, drop-down menus, guest books, single-page or multipart forms, image maps, and cookies. The author of both the book and Perl library function, Stein provides ample discussion of all of these areas, along with strong code examples. The book ends with a verbose reference guide detailing all of CGI.pm's functions and features, grouped both alphabetically and by topic.
The use of CGI.pm requires a mind shift for Web site managers, but it's one worth making. Instead of tags for 'input' and 'select', CGI.pm uses statements such as "checkbox ()" and "textfield ()," allowing documents to be read easily and updated quickly.
--Jennifer Buckendorff
Customer Reviews & Comments
The first half of the book is a great tutorial on using the CGI.pm module. There are all sorts of tricks, and Lincoln's explanations are very good. If you want a tutorial, this is it. However, the reference section is a mess. It's not clear how the various functions are grouped, and there are no guides in page headings to tell you where you are as you thumb through. If you're looking for a desktop reference, you're probably better off using the CGI section of "Perl In A Nutshell". Finally, the book looks like it was thrown together in Word, with no real thought about how it would look. Chapter titles are in grey: Why?