REVIEW - Perl Template Toolkit

Title:

Perl Template Toolkit

Author:

Darren Chamberlain, Dave Cross, Andy Wardley

ISBN:

0596004761

Publisher:

O'Reilly (2003)

Pages:

574pp

Reviewer:

Jon Wilks

Reviewed:

October 2004

Rating:

★★★★★

cover all aspects of this tool

Template Toolkit (TT2) is a template processing system typically used for web site creation. The input data could be anything from variables specified at run time, an XML file or a database accessed via DBI for example. The templates could be structured to produce HTML but could just as easily be used to create XML, PDF or conceivably even source code - any application where there is the requirement to separate data and presentation. The book itself was written in Perl's pod system and processed using TT2.

This first edition of the book is based on version 2.1 of TT2. Its chapters describe TT2 in detail and go through, in tutorial fashion, the construction of a web site. The beauty of TT2 is that knowledge of Perl is not actually required to use this tool and the template language itself could be embedded easily by non-technical personnel (for form layout for example). Optional scripts are supplied with the Perl module that will process a single page or an entire tree of templates. Their use is covered well in the book.

The 12 chapters and 1 appendix cover all aspects of this tool from the syntax and directives up to internals and extension. TT2 is not the only template kit around and the "getting started" chapter offers a comparison of the other template systems available. All the code examples in the book are available from the O'Reilly website. After reading the first two chapters the rest of the book is written in a style that can be easily browsed as required. The reader is initially led gently from one concept to the next with later chapters offering a description of the template language, template directives, filters and plugins. Over two chapters, the anatomy of the system is described and information describing how to further extend TT2 is given.

I found the very easy to follow and in fact I have been using the template toolkit extensively for creating Unix system recovery documentation in a format independent manner, creating html, rtf and man pages from a single source tree. The template toolkit has made this simple and for that reason I highlyrecommend this book.


Book cover image courtesy of Open Library.