Synopses & Reviews
Mason doesn't aim to be the one true Perl-based templating system for building web sites, but it's led many programmers to abandon their custom solutions when they've seen how much easier using Mason can be. It's a powerful, open source, Perl-based web site development and delivery engine, with features that make it an ideal backend for high load sites serving dynamic content. Mason uses a concept called components: a mix of HTML, Perl, and special Mason commands. These components can be entire web pages, or bits of HTML that can be embedded in top-level components. Shared and reusable, these components greatly simplify site maintenance: when you change a shared component, you instantly change all pages that refer to it.Although using Mason isn't difficult, creating a Mason-based site can be tricky. Embedding Perl in HTML with Mason, written by members of Mason's core development team, shows you how to take advantage of Mason's strengths while avoiding the obstacles that inexperienced users may encounter. Mason's unique features, when used properly, can streamline the design of a web site or application. This concise book covers these features from several angles, and includes a study of the authors' sample site where these features are used.Embedding Perl in HTML with Mason shows you how to create large, complex, dynamically driven web sites that look good and are a snap to maintain. You'll learn how to visualize multiple Mason-based solutions to any given problem and select among them. The book covers the latest line of Mason development 1.1x, which has many new features, including line number reporting based on source files, sub-requests, and easier use as a CGI. The only book to cover this important tool, Embedding Perl in HTML with Mason is essential reading for any Perl programmer who wants to simplify web site design. Learn how to use Mason, and you'll spend more time making things work, and less time reinventing the wheel.
Mason, a Perl-based templating system, is becoming more and more popular as a tool for building Web sites and managing other dynamic collections. This text covers the first new release of Mason, which includes a number of changes that users have wanted for a long time.
This is the first book to introduce Mason, an open source Perl-based platformwith template elements.
About the Author
is a programmer, author, and activist with a background in music composition and an obsession with Hong Kong films and the works of author Gene Wolfe. He has been actively developing Free (Perl) Software for several years and is a member of the Mason core development team. For more information about Embedding Perl in HTML with Mason please visit www.masonbook.com, a web site maintained by the authors where additional information and downloadable source code are available.
is a researcher in Document Categorization at the University of Sydney in Australia. He has written many Perl modules of varying utility, about 20 of which are available on CPAN. Like co-author Dave Rolsky, Ken is a member of the HTML::Mason core development team. His educational background is in mathematics and music. For more information about Embedding Perl in HTML with Mason please visit www.masonbook.com, a web site maintained by the authors where additional information and downloadable source code are available.
Table of Contents
Foreword; Preface; Intended Audience; Requirements; How to Read This Book; Overview; Other Resources; Typographic Conventions; We'd Like to Hear from You; Open Publication License; Acknowledgments; Chapter 1: Introduction; 1.1 A First Example; 1.2 The Main Features of Mason; 1.3 Alternatives to Mason; 1.4 Philosophy; 1.5 Getting Started with Mason; Chapter 2: Components; 2.1 Mason from 10,000 Feet; 2.2 Core Concepts; 2.3 Basic Component Syntax; 2.4 Component Arguments; 2.5 Component Return Values; 2.6 Special Globals; 2.7 Sample Component; Chapter 3: Special Components: Dhandlers and Autohandlers; 3.1 Dhandlers; 3.2 Autohandlers; 3.3 Using Autohandlers and Dhandlers Together; Chapter 4: APIs; 4.1 Request Class and Object API; 4.2 Component Object API; 4.3 Buffers; Chapter 5: Advanced Features; 5.1 Subcomponents; 5.2 Creating Components on the Fly; 5.3 Sharing Data Among Component Sections; 5.4 Methods and Attributes; 5.5 Calling Components with Content Blocks; 5.6 Advanced Inheritance; 5.7 Subrequests; Chapter 6: The Lexer, Compiler, Resolver, and Interpreter Objects; 6.1 Passing Parameters to Mason Classes; 6.2 The Lexer; 6.3 The Compiler; 6.4 The Resolver; 6.5 The Interpreter; Chapter 7: Using Mason with mod_perl; 7.1 Configuring Mason; 7.2 Document Root Versus the Component Root; 7.3 Not OK; 7.4 $r; 7.5 ApacheHandler Parameters; 7.6 To Autoflush or Not to Autoflush; 7.7 Generating Something Besides HTML; 7.8 Apache::Status and Mason; Chapter 8: Building a Mason Site; 8.1 Functionality; 8.2 Directory Layout; 8.3 File Extensions; 8.4 Apache Configuration; 8.5 The Components; 8.6 Components with Access Controls; 8.7 All Done; 8.8 Further Directions; Chapter 9: Mason and CGI; 9.1 CGI-Appropriate Situations; 9.2 CGI-Inappropriate Situations; 9.3 Creating a CGI-Based Site in Mason; 9.4 Using Mason Templates Inside Regular CGI Scripts; 9.5 Differences Between Mason Under CGI and mod_perl; Chapter 10: Scalable Design; 10.1 Modules Versus Components; 10.2 Components as Independent Units; 10.3 Component Layout; 10.4 File Naming and Directory Layout; 10.5 Random Advice; Chapter 11: Recipes; 11.1 Sessions; 11.2 Making Use of Autoflush; 11.3 User Authentication and Authorization; 11.4 Co-Branding Color Schemes; 11.5 Developer Environments; 11.6 Using Mason Outside of Dynamic Web Sites; Chapter 12: Custom Mason Subclasses; 12.1 Class::Container as a Superclass; 12.2 Syntax: Your Very Own Lexer; 12.3 Output: Compiling to a Different Output; 12.4 Storage: Replacing the Resolver; 12.5 Request: A Request Object with a Built-in Session; 12.6 Argument Munging: ApacheHandler; 12.7 More Reader Exercises; The Mason API; Interpreter; Request; Component; Resolver; ApacheHandler; CGIHandler; Compiler; Lexer; Object Constructor Parameters; HTML::Mason::Interp; HTML::Mason::Request; HTML::Mason::Resolver::File; HTML::Mason::ApacheHandler; HTML::Mason::Compiler; HTML::Mason::Component; HTML::Mason::Buffer; HTML::Mason::CGIHandler; HTML::Mason::Lexer; Text Editors That Understand Mason; Emacs; Vim; Content Management with Bricolage; Installing Bricolage; Elements: the Building Blocks of Content; Content Editing; Templates; Where to Learn More; Glossary; Colophon;