(You are Anonymous)

A Comparison of templating systems used with CGI::Application

The use of a templating system is one extremely important step towards creating maintainable and reusable applications, as they make it possible to separate the formatting of the pages from the application logic. You want to have this separation so that you can easily change the looks of your application without messing around in the program, or even have the same program appear differently in different environments (Ideally, someone else than you, the application developer, can also change the design, such as a web designer. In this case, neither you nor the designer want the designer to have to mess with your Perl code).

Unfortunately, templating systems in Perl are an extremely over-implemented genre. You can find dozens of them on CPAN and elsewhere. They all have their own distinctive features, benefits and drawbacks. It is very difficult to choose the right one, and trying to give advice can lead to terrible flamewars. A very good article which compares several popular systems can be found at the Apache mod_perl project.

The two most popular templating systems for CGI::Application users seem to be

Other recommended modules include:

Online Poll

Maybe we can run a little poll here... Everyone just add a + for their favorite tool (and update the count):

Template Toolkit    (20) ++++++++++++++++++++
HTML::Template      (19) +++++++++++++++++++
Petal               (6)  ++++++
Text::Template      (2)  ++
Text::Xslate        (1)  +
home-made toolkit   (1)  +

no template toolkit (1)  +

See Also

  • The [plugins Plugins] page list several template-related plugins
  • A related topic is content management systems (CMS) which provide whole toolsets to manage a large amount of content. They usually also contain a templating system. A comprehensive list of Open Source Content Management Systems (Perl and others) can be found at http://www.la-grange.net/cms