Template
Code
Examples
Licence
Programs
Orangeness
What It Is

The module Template.pm is a general purpose Perl utility class to expand arbitrary template files producing arbitrary text. It was written to make it easier to build web sites with variable skins, but there are many other uses for a tool like this.

The usual source for Perl utility classes is CPAN, but you won't find Template there. I wrote this class because I needed it, and didn't check CPAN first to see if something similar was already available (I'd just started using Perl and only had dial up at home at the time). Naturally, there are several modules on CPAN offering template expansion.

I maintain Template.pm because it is used by several tools I have written, and in my web sites. It also supports expansion to stream by the use of iterators, a critical feature for generating very large web pages. And I like the template syntax, which is compatible with the bracket matching features of source code editors like vim.

Top

Code

The current Perl version is 1.20, released on 21-September-2005: Template.pm

Read the documentation.

To install this module, copy it into a directory on your Perl library path.

I have also ported this to Java - everything works except the eval construct. This is still in an early form, with incomplete unit tests, and I will post this once it is more stable.

Top

Examples

These are tools that I have written that use Template.pm. There are no public examples of org.dunx.template usage.

  • tplexp - a generic template expansion utility, using a simple symbol file syntax to define token values. I use this to generate all of my non-photo web pages, such as this one.
  • weeklog - I always keep a text file open to make notes and so on. This is the tool I use to generate a new file at the beginning of each week. It works on both Windows and *nix.

Top

Licence

This software copyright (c) Duncan Ellis 1999-2005.

This is freely distributable software, but I'd appreciate your passing any fixes or improvements back to me so I can publish them here.

No warranty is offered for the fitness of this software for any particular purpose. Use it at your own risk.

Top

Template
Code
Examples
Licence
Programs
Orangeness
Last updated 05-May-2009