Clear questions and runnable code
get the best and fastest answer
MySQL and Perl for the Webby kwoff (Friar)
|on Nov 04, 2001 at 05:14 UTC||Need Help??|
Item Description: A book on using MySQL and Perl for the Web
MySQL and Perl for the Web is the second MySQL-related book by Paul DuBois, who is a contributor to the MySQL documentation. I thought his first MySQL book a couple years ago was outstanding; naturally then, being a web developer myself, I was excited when I found this book on the shelves. If you're new to making web-based database interfaces, or even if -- like me -- you're looking for ideas on how to automate database-driven HTML forms, then this book is a good investment.
Audience: novice- to intermediate-level web developers, though there are some cool tricks even for advanced developers
Okay, I admit, after the initial pavlovian drooling, my next thoughts were along the lines of "isn't this just a book on how to create Perl CGI scripts, and am I not tired of making CGI scripts, so why am I looking at this book?" Well, for one thing, there's only one mod_perl book, the Eagle book, and I've read that, and it's getting old anyway, so if I wanted to get away from these tedious CGI scripts, yet still spend the money burning in my pocket while I was at the bookstore, then my alternative was to get a book on Java servlets (actually I did, but that's another story :). On closer inspection, however, this actually is a book on mod_perl -- or, at least on Apache::Registry scripts, which are CGI scripts stuffed into a mod_perl subroutine.
The first few chapters of the book are for newbies. Of course. Chapter 1 is a high-level background chapter, basically saying "this class covers MySQL and Perl, is everyone in the right classroom? Bueller?". Chapter 2 gets the newbie up and running with MySQL and Apache. This chapter includes test CGI scripts that access MySQL to verify that the installation is working, and it gives tips along the way on what might go wrong. Chapter 2 also introduces WebDB.pm (see "Companion website" below), which is a DBI.pm wrapper library developed as the book progresses, and is one of the most useful things to come from the book if you ask me.
Chapter 3 spanks you for using CGI scripts instead of Apache::Registry. Steempy, you eediot!
Chapter 4 introduces techniques for using CGI.pm to process HTML forms. Chapter 5 then illustrates those techniques with several example applications: product registration, email, a contest, a poll, storing/retrieving images, and greeting cards. Those are pretty typical applications that you're likely to run into as a web backend developer.
As I mentioned above, I'm getting tired of writing variations of the same form-handling CGI scripts, so I found chapter 6 to be glorious (*sound of organs and harps, choir singing hallelujah*). In this chapter, you take it to the next level and use meta-data -- that is, information about the database as opposed to information in the database -- to automatically generate simple tables and to do some verification of form input. Okay, let's be real, this isn't a panacea. However, although it's not going to work in all cases, it's certainly a start, and it'll give you ideas to implement yourself. In fact, I used WebDB.pm with HTML::Mason to make create automatic tools for lusers to administrate simple database tables (no references to other databases) using web interfaces (basically that's my job description).
Moving right along, chapter 7 is 60 pages of how to do web searches. Odd finding that in a book called "MySQL and Perl for the Web". </sarcasm>
Chapter 8, on session management, was actually one of the reasons I bought the book, as I was trying to figure out how to use Apache::Session with HTML::Mason at that time. After reading this book, I got it working! (Come on, I would've got it anyway.) There's even a WebDB::Session.pm wrapper to make life even simpler.
Chapter 9 is on security issues. It even explains how to build and configure Apache for SSL support. If you've ever tried that on your own, you'll appreciate this explanation. And finally, right after the chapter on security, comes chapter 10 on e-commerce.
In conclusion, I really found this book useful and would recommend it to aspiring and experienced web developers alike.