Book Reviews   Digital Libraries   Astronomy Log   Software   About  
Embedding Perl in HTML with Mason
Author: Dave Rolsky & Ken Williams
Pages: 297
Publisher: O'Reilly & Associates
ISBN: 0-596-00225-4
Summary: Should have been titled Mason: The Definitive Guide
Review Date: 26 Mar, 2003

Mason provides Perl web-application developers a unique way to build web sites using building blocks of Perl and HTML called 'components.' Any given Mason component can take arguments, and allows you to embed Perl right into your HTML if you want. Mason components can inherit functionality from other Mason components, and Mason's autohandler and dhandler mechanisms make it a snap to build easily brandable, dynamic websites. Mason is indeed a powerful templating engine, but is also so much more. O'Reilly's Embedding Perl in HTML with Mason provides an excellent introduction as well as an in-depth guide to this powerful tool.

As a preliminary, if you're not very comfortable with Perl you may wish to start elsewhere, as the book assumes a pretty solid knowledge of CGI and mod_perl programming. If you find yourself lacking in Perl prowess, you may wish to spend some quality time with the excellent Camel Book.

Carrying on then, the book begins with a quick overview of Mason's capabilities, and in the interest of fairness also discusses some of the alternatives to Mason. I found this coverage, however, to be distracting. I knew I wanted to learn about Mason, so by the end of the chapter I was saying to myself, let's get on with it already. Fortunately the authors deliver well in the rest of the book.

The meat begins with a high-level view of Mason, introducing the set of tags available to embed Perl in your HTML, call other components, handle arguments, set flags and so forth. Discussion of the powerful autohandler and dhandler mechanisms follow, and then a chapter outlining the API available to Mason components. The API is also provided with less verbiage as an appendix. Discussion of the API early on like this is helpful, but I found it somewhat detracting from the flow of the material. By this point however, the book has covered enough ground to get you on your way to building basic sites with Mason.

Moving on the book progresses into more advanced topics, covering dynamic component creation, subcomponents, component methods and attributes, and further discussion of the powerful inheritance mechanism. A chapter in this area covers the internals of the various Perl modules that make up Mason, and how they interact to do the work that makes Mason so nice to use. Also you'll find a chapter on how to confiugure mod_perl so you can use Mason. If mod_perl isn't your style, isn't available, or for some other reason you're stuck using Mason as a stand-alone CGI, there is also a chapter which dicsusses these scenarios, and how best to use Mason under such circumstances.

A chapter of common Mason recipes is provided, covering topics from session management, to user-authentication and authorization, and implementing development environments. For those with too much time on their hands, or a penchant for massive customization, the authors delve even deeper into the guts of the Mason Perl modules in the final chapter, demonstrating how you could alter the default syntax for Mason blocks in HTML, as well as other ways to tweak Mason for whatever need you might have. Finally, the appendices offer an API reference, an object constructor parameter reference, a discussion of text editors that grok Mason code, and a detailed introduction to Bricolage, a very powerful content management system built with Mason.

A major plus for this book is the large number of examples it provides of just about everything it discusses. Chapter 8 provides a detailed walk-through of a complete web application (apprentice.perl.org) using Mason. In good pedagogical style, the site provides a fairly wide spectrum of just what you can do with Mason. This chapter alone will provide numerous tips and pointers for anyone cutting their teeth on Mason.

I found the book very useful in my own work as I have been developing a complex intranet web application with Mason. The book provided everything I needed to learn how to use Mason to build my application.

In summary, if you're already settled on your favorite templating engine, you may not be converted to Mason, but if you're looking, then Mason might fit your ticket, and Embedding Perl in HTML with Mason is a fantastic way to get started. It's packed with examples to get you going, and provides enough depth to really get into the guts of Mason should you need to do major surgery. As my summary states, O'Reiily could just have well called this book, "Mason, the Definitive Guide." It's great for beginners and experienced users alike. I would recommend it to anyone who uses or is interested in learning about Mason.

Overall rating: 9/10

Happiness
True love begins when the needs of others become more important than your own.
The practice of true love begets true happiness

Me

Daniel Hanks

I'm a system administrator working for Omniture

Interested in

perl
books
python
databases
genealogy
astronomy
digital archival
digital libraries
web applications
web infrastructure
distributed storage

among other things . . .

Storyteller


Pamela Hanks

is an excellent storyteller.

(She also happens to be my wife :-)

A storyteller makes a wonderful and unique addition to family, school, church or other group events. Schedule her for your next gathering.


Utah Open Source

Kiva.org
Kiva - loans that change lives

Recent Blog Entries

Subscribe with Bloglines
- E-Book Review: Data Mashups in R
- Book Review: Illustrated Guide to Astronomical Wonders
- Book Review: Wicked Cool Shell Scripts
- PLUG Presentation Slides: The Open Source Data Center
- Harnessing human computational power from computer games
- I love a good roadtrip
- FamilySearch Developers Conference 2008 presentations now available online
- FHT follow up: an idea for a mobile genealogical application
- Family history and technology: it's only getting better
- President Hinckley passes away
- December is NaBoMoReMo - National Book of Mormon Reading Month
- Family History, Photos, Blogs, and Books
- The Compact Oxford English Dictionary
- 1830s English and the Book of Mormon
- Google adds My Library feature to Book Search
- Utah Open Source Conference
- Wiki diagrammer (Steal this idea!)
- Microloans at Internet-scale
- Podcasting content created by someone else
- Silver Lining thought: Parking at work

All Entries . . .

LDSOSS
LDS Open Source Software
A website discussing the use of Open-source software for applications useful to those sharing values of the Latter-day Saint (Mormon) faith.

© 2009, Daniel C. Hanks