The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

SEE ALSO

A mailing list exists for up-to-date information on the Template Toolkit and for following and contributing to the development process. Send email to majordomo@cre.canon.co.uk with the following message in the body:

  subscribe templates

The following modules comprise the Template Toolkit. Consult the individual documentation for further details.

Template::Context

The Template::Context module defines a class of objects which each represent a unique run-time environment in which templates are rendered. The context maintains references to the stash of variables currently defined (Template::Stash) and to a cache object (Template::Cache) which provides access to template files. It also defines the output() method through which template output is directed and provides the error() and throw() methods for error handling. The main process() method is called to render a template within the context.

Template::Stash

The Template::Stash module defines an object class which is used for storing, retrieving and evaluating variables and their values for run-time access and processing by templates.

Template::Cache

The Template::Cache module defines an object class which is used to find, load, parse, compile and then cache template documents. The cache implements a simple fetch($template) method which will accept a wide range of inputs (filename, text ref, GLOB, IO::Handle, etc) and attempt to read the template and call on a Template::Parser to parse and compile it to an internal form. This is then cached for subsequent fetch() calls for the same template.

Template::Parser

The Template::Parser module defines an object class which implements the template parser and compiler. The template text is first scanned by a Perl regex which breaks the text into chunks and lexes the tokens within directive tags. A DFA (Deterministic Finite-State Automation) then iterates through the tokens using the rules and states defined in Template::Grammar and generates a compiled template document represented by the root node of a tree of Template::Directive objects. The rendering context may then call the process() method of the root node, passing itself as a reference, to render the template.

Template::Grammar

The Template::Grammar module defines the rules and state tables for the Template::Parser DFA. These are generated by the Parse::Yapp module. The Template-Toolkit distribution contains a parser directory which contains further files and information concerning the grammar and compilation thereof.

Template::Directive

The Template::Directive module defines a base class and a number of derived specialist classes to represent directives within template documents. These are instantiated by the Template::Parser object from actions defined in Template::Grammar.

Template::Exception

The Template::Exception module defines a primitive exception type for representing error conditions within the Template Toolkit.

Template::Iterator

The Template::Iterator module defines a data iterator which is used by the FOREACH directive. This may be sub-classed to create more specialised iterators for traversing data sets.

Template::Plugin

The Template::Plugin module defines a base class for Template Toolkit extension modules that can be loaded via the USE directive.

Template::Plugin::Filter

A specific plugin module which implements the FILTER methods.

Template::Constants

Defines various constants used in the Template Toolkit.

Template::Utils

Defines utility functions.

Template::Debug

Defines functions and methods for debugging (incomplete).