TEMPLATE TOOLKIT PLUGINS

The following plugin modules are distributed with the Template Toolkit.

Format

The Format plugin provides a simple way to format text according to a printf()-like format.

[% USE bold = format('<b>%s</b>') %]
[% bold('Hello') %]
URL

The URL plugin provides a simple way of contructing URLs from a base part and a variable set of parameters. See Template::Plugin::URL for further details.

[% USE mycgi = url('/cgi-bin/bar.pl', debug=1) %]

[% mycgi %]
   # ==> /cgi/bin/bar.pl?debug=1

[% mycgi(mode='submit') %]
   # ==> /cgi/bin/bar.pl?mode=submit&debug=1
Table

The Table plugin allows you to format a list of data items into a virtual table by specifying a fixed number of rows or columns, with an optional overlap. See Template::Plugin::Table for further details.

[% USE table(list, rows=10, , overlap=1) %]

[% FOREACH item = table.col(3) %]
   [% item %]
[% END %]
CGI

The CGI plugin is a wrapper around Lincoln Stein's <lstein@genome.wi.mit.edu> CGI.pm module. The plugin is distributed with the Template Toolkit (see Template::Plugin::CGI) and the CGI module itself is distributed with recent versions Perl, or is available from CPAN.

XML::DOM

The XML::DOM plugin gives access to the XML Document Object Module via Clark Cooper <cooper@sch.ge.com> and Enno Derksen's <enno@att.com> XML::DOM module. The plugin is distributed with the Template Toolkit (see Template::Plugin::XML::DOM) and requires the XML::DOM module, available from CPAN:

http://www.cpan.org/modules/by-module/XML
XML::RSS

The XML::RSS plugin is a simple interface to Jonathan Eisenzopf's <eisen@pobox.com> XML::RSS module. An RSS (Rich Site Summary) file is typically used to store short news 'headlines' describing different links within a site. This plugin allows you to parse RSS files and format the contents accordingly using templates. The plugin is distributed with the Template Toolkit (see Template::Plugin::XML::RSS) and requires the XML::RSS module, also available from CPAN:

http://www.cpan.org/modules/by-module/XML

The following module is distributed separately from the Template Toolkit.

DBI

Simon Matthews <sam@knowledgepool.com> has developed a DBI plugin for the Template Toolkit which brings the full power of Tim Bunce's <Tim.Bunce@ig.co.uk> database interface module (DBI) to your templates. The DBI plugin and the DBI modules themselves are available from CPAN at:

http://www.cpan.org/authors/id/S/SA/SAM/
http://www.cpan.org/modules/by-module/DBI/