The following book reviews are the copyright of their respective authors and no part should be reproduced without the express permission of the author. Publishers and Authors of the books reviewed may reproduce the whole or extracts of a review for their book. To request copyright permission please email email@example.com.
All the reviews herein are the opinions of the reviewer and are not necessarily the views of Birmingham Perl Mongers and its members. If you feel a review or comment has been made in error, please contact firstname.lastname@example.org to rectify the situation.
Static Link: http://birmingham.pm.org/reviews/3
|Title:||Perl Template Toolkit|
|Author(s):||Darren Chamberlain, David Cross & Andy Wardley|
I have been using Template Toolkit for over three years now, and have implemented many web sites and document processing applications using it. The reusability and ease with which you can adapt and extend templates makes it a very powerful tool. This book leads you though the basic steps and tools of the toolkit, through to the complex plugins and guts of the modules.
The Template Toolkit can be used in 4 ways, from the command line using the tpage and ttree programs, within your Perl script or via mod_perl with an Apache enabled web server. To begin using Template Toolkit only takes a few minutes of reading, but to get the most out of it ... read on.
We begin with a quick look at other templating systems, of which there are many, most specifically for HTML or other markups languages. When the Template Toolkit is installed, a host of other documents, tutorials and programs are also installed. The book also references the many online resources, newsgroups and mailing lists, where there are many developers and users who are willing to help if you have any questions.
The book then looks at the command line tools, tpage and ttree, that can be used for standalone template processing. A basic introduction to the central module, Template, follows, along with a quick guide to the Apache module, Apache::Template.
We are introduced to the basic processing language used in the templates, which is fairly straight-forward and doesn't take long to get you going. We are shown the declaration and use of variables, how to implement lists and hashes and even methods. The directives then allow you to manipulate variables and values into the template presentation.
After all that, we get to the second chapter! With the ground work laid, Chapter 2 shows us how easy it is to create some complex web sites using the Template Toolkit. Starting with a familiar "Hello World" presentation, we delve into the processing of dynamic web sites.
Next we look more into the Template Language & Directives. Much of what is contained in these two chapters is available from the documentation and tutorials available with Template Toolkit and online. However, the authors have gone to great effort to give some very good examples and explanations that extend any previously available documentation.
For many that is possibly about as far you'll really need to go to get what you want out of the Template Toolkit. If you want to get more, often much more, out of the toolkit, then the Filters and Plugins get you further on your way. These two chapters read similar to a nutshell reference guide, detailing the many filters and plugins available, with careful well presented explanations and examples.
Having dispensed with creating and processing templates and web sites, we get to the Anatomy of the Template Toolkit. This chapter is pretty much a thorough dissection of the guts of the toolkit's core modules and runtime engine, that drives template processing. By exposing the inner workings, you get the ability to further extend Template Toolkit, which is also the subject of the following chapter. There are many ways you can extend Template Toolkit, several of which are listed here, but its fairly easy to invent your own.
Accessing Databases shows you can enable the toolkit to talk to your database using the DBI. The XML chapter covers the many ways the toolkit can create and transform XML formatted data.
The Advanced Static Web Page Techniques, is a bit of a misnamed chapter in my opinion, as many of the techniques for templates are applicable to dynamic page creation. The introductory paragraphs also admit this, so I'm curious why the authors felt they need to emphasise the 'Static' bit. There are specific subheadings devoted to ttree, but the actual template examples are not.
Examples for generating CSS files was something I'd not thought of doing, but in a dynamic context how easy is it to create a template and have colours that are chosen by an individual user and used for each page they request, all on the fly? Debugging pages, navigation pages, nested menus, bread crumbs, table of contents and skins are really great cookbook ideas, and would perhaps be better as a separate chapter. The example of next/previous page links is very similar to what I use, although I make extensive use of Data::Pageset to do this too, which would perhaps be a nice example to include in a future edition.
The final chapter, Dynamic Web Content and Web Applications, looks more at the CGI and mod_perl applications that can use Template Toolkit. It also includes a complete guide to creating a mod_perl enabled web application, which guides you through both the programmatic aspects and the Apache configuration.
The one Appendix includes all the Configuration Options for both Template and Apache::Template, in another reference guide style layout.
All in all I found this a pretty thorough book. If there are any mistakes or omissions I didn't spot them. There is a lot to learn from this book and if you plan to use or are using Template Toolkit, it is a book well worth investing in. As a companion book it might be interesting to have a Template Toolkit Cookbook, with examples of using other modules to extend your templates, and with the growing use of the package there are no shortage of examples.
I think this will probably be one of my most read books in years to come.
- Barbie, March 2004
We are one of the UK's largest Perl user groups, representing Birmingham UK to the international Perl community since 2000. We hold monthly social and technical presentations, and several of our members are now regular attendees and speakers at the YAPC::Europe Perl Conferences.
For further information about Birmingham.pm, please read our Frequently Asked Questions page.
For details about joining our mailing list, please Click Here for more details.
Ads provide by
The Perl Community AdServer
12 Nov - Brum.pm Social
3 Dec - Brum.pm Technical
10 Dec - Brum.pm Social
Download the Birmingham.pm ICalendar
or subscribe to our Google Calendar
Aberdeen Perl Mongers
Bath Perl Mongers
Birmingham Perl Mongers
Bristol Perl Mongers
Devon & Cornwall Perl Mongers
Edinburgh Perl Mongers
Glasgow Perl Mongers
London Perl Mongers
Milton Keynes Perl Mongers
North of England Perl Mongers
Nottingham Perl Mongers
Southampton Perl Mongers
Thames Valley Perl Mongers
• Linux System Programming
• Mastering Perl
• GIMP 2 for Photographers
• Minimal Perl
• Wicked Cool Perl Scripts
• Red Hat Linux 9 Unleashed
• IRC Hacks - 100 Industrial-Strength Tips & Tools
• eBay Hacks - 100 Industrial-Strength Tips & Tools
• Exploiting Software - How To Break Code
• Mac OS X Unleashed, 2nd Edition
* New Reviews
.. More Reviews