A Review by Andy Lester
I'm a sucker for practical instruction. Theory's fun for a while, but even in my geekiest moments, I'm usually trying to get something accomplished. I've read more than enough chapters on inheritance that use shapes ("squares have an is-a relationship with polygons"), or trivial web counter scripts that don't even address file locking. Embedding Perl In HTML With Mason is one of the most practical books I've read in a while.
Dave Rolsky and Ken Williams are two of the main developers of Mason, a Perl-based web templating system that powers many web applications, including RT, Bricolage and Alzabo, and sites like Stamps.com and Salon. The book reflects the years of real-world applications that Mason has been used for, and is aimed at the Perl programmer with sites to create.
After a quick overview of Mason and its alternatives, such as Embperl and HTML::Template, Rolsky and Williams assume that you know Perl already and jump straight into Mason syntax. From the beginning, there's great emphasis on Mason's component structure and reusability across sites.
Two chapters are standout examples. "Building A Mason Site" is a 50-page discussion of what went into building the apprentice.perl.org web site. It explains design decisions and overview of the site, and gives annotated code listings of selected components. The "Recipes" chapter is 30-page catch-all of various tools to perform common tasks like authentication and database connection management.
The Mason backend isn't ignored. There are chapters on mod_perl and CGI and when it's appropriate to use each. I would have liked to see a section specifically on performance tuning, but scalable design does get its own chapter. An Appendix provides a listing of the Mason API.
So should you buy the book, if masonhq.com has extensive documentation? If you're new to Mason, it's well worth your $35 to have a guided introduction. To the experienced Mason developer, there's still an advantage to seeing Mason code written the way that the authors intended, or learn a new idiom. The book requires a Mason version 1.10 or higher, so developers who cut their teeth on the older versions will probably get something new, too. The book does seem to collect and organize a great deal of the conventional wisdom learned over the past three years of Mason development.
This review is reproduced with permission from Andy Lester. It originally appeared in The Perl Review, Volume 0, Issue 7.
About Andy Lester
Andy Lester leads a team of Perl and PHP programmers on the e-commerce site for Follett Library Resources, the number one vendor of school library books in the US.