Template::Modules (3)
Leading comments
Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) Standard preamble: ========================================================================
NAME
Template::Modules - Template Toolkit ModulesTemplate Toolkit Modules
This documentation provides an overview of the different modules that comprise the Template Toolkit.Template
The Template module is the front-end to the Template Toolkit for Perl programmers.
use Template; my $tt = Template->new(); $tt->process('hello.html', message => 'Hello World');
Template::Base
The Template::Base module implements a base class from which the other Template Toolkit modules are derived. It implements common functionality for creating objects, error reporting, debugging, and so on.Template::Config
The Template::Config module defines the configuration of the Template Toolkit for your system. It is an example of a factory module which is responsible for instantiating the various other modules used in the Template Toolkit.For example, the Template::Config module defines the $STASH package variable which indicates which version of the Template::Stash you are using by default. If you elected to use the faster
XS
stash when you installed the Template Toolkit, then this will be set as:
$STASH = 'Template::Stash::XS';
Otherwise you'll get the regular Perl stash:
$STASH = 'Template::Stash';
This approach means that other parts of the Template Toolkit don't have to worry about which stash you're using. They just ask the Template::Config module to create a stash of the right kind.
Template::Constants
The Template::Constants defines a number of constants that are used by the Template Toolkit.For example, the ":chomp" tagset defines the "CHOMP_???" constants that can be used with the "PRE_CHOMP" and "POST_CHOMP" configuration options.
use Template::Constants ':chomp'; my $tt = Template->new({ PRE_CHOMP => CHOMP_COLLAPSE, });
Template::Context
The Template::Context module defines a runtime context in which templates are processed. A context keeps track of all the templates, variables, plugins, and other resources that are available (either directly or through delegate objects) and provides methods to fetch, store, and perform various operations on them.Template::Document
The Template::Document module implements a compiled template document object. This is generated by the Template::Parser module.Template::Exception
The Template::Exception module implements an exception object which is used for runtime error reporting.Template::Filters
The Template::Filters module implements a filter provider. It includes the core collection of filters that can be used via the "FILTER" directive.Template::Iterator
The Template::Iterator module implements a data iterator which steps through each item in a list in turn. It is used by the "FOREACH" directive. Within a "FOREACH" block, the "loop" variable always references the current iterator object.
[% FOREACH item IN list; IF loop.first; # first item in loop ELSIF loop.last; # last item in loop ELSE; # any other item in loop END; END %]