- Introduction
- Pre-Requisites
- Installing from Source Code
- Developer Versions
- Installing with the CPAN Module
- Platform-Specific Binaries
- Mac OSX
- Debian GNU/Linux
- Microsoft Windows
- Subversion Source Code Repository
- HTML Documentation
- Related Modules
- Editor Bundles
- TextMate
- Emacs
- Kate: KDE Advanced Text Editor
- jEdit
- Joe
- Komodo
- Vim
The Template Toolkit is free in both senses of the word: free beer and free speech. It is free in the first sense because it costs absolutely nothing to download and use the Template Toolkit. And it's free in the second sense because it's distributed under an Open Source license. That mean that you get the full source code to the Template Toolkit and you're explicitly granted the right to modify and adapt the code, should you so wish.
You'll need to have Perl version 5.6.0 or later installed on your machine. Perl comes pre-installed on all modern Unix-based systems (which includes Mac OSX). It's freely available for virtually every modern operating system under the sun, so you have no excuse for not installing it if you don't already have it. Don't be scared now. You don't have to write any Perl code to use the Template Toolkit.
The Template Toolkit also depends on the Perl AppConfig module being installed. But if you use the CPAN module as described below then it will take care of this for you.
Stable versions of the Template Toolkit source code can be downloaded from CPAN. The latest stable version of the Template Toolkit is 2.21.
Download Template Toolkit stable version 2.21
The source code is distributed as a .tar.gz archive.
You'll need to unpack it and follow the instructions in the
INSTALL file.
For those impatient types who don't have time to read the documentation, it goes like this:
$ tar zxf Template-Toolkit-2.21.tar.gz $ cd Template-Toolkit-2.21 $ perl Makefile.PL $ make $ make test $ sudo make install
In addition to the stable releases available from CPAN, we also release interim developer versions from time to time. These contain additional features, bug fixes and other updates over the latest stable version.
Developer versions have an additional character suffix (e.g. 2.21a, 2.21b, etc) and are available to download from this web site. Developer releases eventually go on to become the next stable release and made available on CPAN.
There are no developer versions released at present.
If you have the CPAN module installed then you can install the Template Toolkit like so:
$ sudo cpan Template
The above assumes a Unix-like system (which includes Mac OSX) and uses
sudo to run the cpan Template command with administrator privileges.
The CPAN module is distributed with more recent versions of Perl (5.8 and later) so there's a good chance you've already got the CPAN module installed if your version of Perl is up-to-date.
You can also get the Template Toolkit in "binary form" for installation on various platforms. Don't be misled by the name - you still get the full source code for the Template Toolkit, but it's delivered in a packaged format that you can install straight onto your system without having to build it from source.
If you're running Mac OSX (you lucky thing!) then you can install the
Template Toolkit using the CPAN module as
described above. Run the Terminal application (located in
Applications/Utilities) and enter the sudo cpan Template
command at the prompt.
Alternately, if you have
Fink
installed then you can use it to install the Template Toolkit.
Christian Schaffner maintains the Fink packages for the Template
Toolkit. They can be found in the libs/perlmods. section.
Mako Hill maintains the official Template Toolkit packages for
Debian
GNU/Linux. They are available in Debian as libtemplate-perl. The
Debian package pages for the latest versions can be found at:
You can download the packages and the source for the latest TT2 packages at:
http://people.debian.org/~mako/outgoing/libtemplate-perl/
If you use stable or testing and
want to use the latest Template Toolkit packages, then
simply add the following line to your sources.list
file:
deb http://people.debian.org/~mako/outgoing/ ./
Of course, you can also install the Template Toolkit on any Unix-like system using the CPAN module, as described above.
If you're using a Microsoft Windows machine then you have our sympathies. However, if you're using Strawberry Perl then you can install TT using the CPAN module as described above. If you're using ActivePerl and then use the Perl Package Manager (PPM) to install the Template Toolkit.
Our friends over at Bugzilla have put a page together telling you where you can find the relevant PPM files.
Links to ActivePerl PPM packagesThe source code for the Template Toolkit is managed using Subversion (svn). If you have subversion installed on your system then you can check out the Template Toolkit source code using a command like this:
$ svn co svn://svn.tt2.org/tt/Template2/trunk Template2
You can also browse the Subversion repository using the web front-end. This is implemented using SVN::Web, which in turn uses the Template Toolkit to generate the web pages. So it's a nice example of just one kind of thing you can do with TT.
http://template-toolkit.org/svnweb/Template2You can download a copy of the complete HTML documentation for the Template Toolkit. It comes in the same shiny colours as this web site for your viewing pleasure.
In times gone by, the Template Toolkit was distributed with a whole bunch of plugin modules for doing all sorts of things. These included: querying databases via the DBI module, processing XML documents, typesetting output using LaTeX, and generating images using the GD library.
In a fit of common sense, they were eventually removed from the core Template Toolkit distribution and made available as separate bundles. You can download them from CPAN using the following links or you can install them using the CPAN module as described above.
Template-DBI Template-GD Template-XML Template-Latex
These modules also have corresponding projects in the Subversion repository.
You can check out the source code using a variation of the svn command
shown in the previous section. e.g.
$ svn co svn://svn.tt2.org/tt/Template-DBI/trunk Template-DBI
The same goes for viewing these projects via the web interface. Simply replace
Template2 with one of the other module names, e.g.