Template Modules -*-org-*-
DATE: 2011/8/24
Surfing for information on Perl modules for command line option
parsing, I discovered the world of template processors. Templates
solve a problem I barely realized I had. A template allows one to
extract the HTML text embedded in a typical CGI program, making both
the source code and the HTML layout cleaner and easier to maintain.
* tirrender template system
Text::Template was recommended
(
http://www.webquills.net/web-development/perl/choose-the-right-template-syst.html)
as being the simplest solution for a site where one programmer is
doing all Perl and HTML coding. It seems adequate for tirrender, and
the absence of more advanced features may help performancs. I'll give
it a try.
* Notable templates systems
There are a large number of template systems available for Perl. The
following is a selection of those I found interesting in order of
decreasing comlexity.
** HTML::Mason
Very sophisticated and complex. Considers itself not just a template
system but a web development platform.
** Template Toolkit
Elegant template mini-language.
** HTML::Template
Simpler mini-language, but adequate for tirender and already
installed at SDF.
** Text::Template
Simplest template system to support loops and other control
structures. Embedded Perl ugly but practical. Available at SDF.
** CGI::FastTemplate
Simple and fast, but only supports variable interpolation.
** Server Side Include
Simplest, but not adequate for tirrender. Cannot be used with CGI (or
does Apache::Include module provide a way?).