1Template::Modules(3)  User Contributed Perl Documentation Template::Modules(3)
2
3
4

NAME

6       Template::Modules - Template Toolkit Modules
7

Template Toolkit Modules

9       This documentation provides an overview of the different modules that
10       comprise the Template Toolkit.
11
12   Template
13       The Template module is the front-end to the Template Toolkit for Perl
14       programmers.
15
16           use Template;
17           my $tt = Template->new();
18           $tt->process('hello.html', message => 'Hello World');
19
20   Template::Base
21       The Template::Base module implements a base class from which the other
22       Template Toolkit modules are derived.  It implements common
23       functionality for creating objects, error reporting, debugging, and so
24       on.
25
26   Template::Config
27       The Template::Config module defines the configuration of the Template
28       Toolkit for your system. It is an example of a factory module which is
29       responsible for instantiating the various other modules used in the
30       Template Toolkit.
31
32       For example, the Template::Config module defines the $STASH package
33       variable which indicates which version of the Template::Stash you are
34       using by default.  If you elected to use the faster XS stash when you
35       installed the Template Toolkit, then this will be set as:
36
37           $STASH = 'Template::Stash::XS';
38
39       Otherwise you'll get the regular Perl stash:
40
41           $STASH = 'Template::Stash';
42
43       This approach means that other parts of the Template Toolkit don't have
44       to worry about which stash you're using.  They just ask the
45       Template::Config module to create a stash of the right kind.
46
47   Template::Constants
48       The Template::Constants defines a number of constants that are used by
49       the Template Toolkit.
50
51       For example, the ":chomp" tagset defines the "CHOMP_???" constants that
52       can be used with the "PRE_CHOMP" and "POST_CHOMP" configuration
53       options.
54
55           use Template::Constants ':chomp';
56           my $tt = Template->new({
57               PRE_CHOMP => CHOMP_COLLAPSE,
58           });
59
60   Template::Context
61       The Template::Context module defines a runtime context in which
62       templates are processed. A context keeps track of all the templates,
63       variables, plugins, and other resources that are available (either
64       directly or through delegate objects) and provides methods to fetch,
65       store, and perform various operations on them.
66
67   Template::Document
68       The Template::Document module implements a compiled template document
69       object.  This is generated by the Template::Parser module.
70
71   Template::Exception
72       The Template::Exception module implements an exception object which is
73       used for runtime error reporting.
74
75   Template::Filters
76       The Template::Filters module implements a filter provider.  It includes
77       the core collection of filters that can be used via the "FILTER"
78       directive.
79
80   Template::Iterator
81       The Template::Iterator module implements a data iterator which steps
82       through each item in a list in turn.  It is used by the "FOREACH"
83       directive.  Within a "FOREACH" block, the "loop" variable always
84       references the current iterator object.
85
86           [%  FOREACH item IN list;
87                 IF loop.first;
88                    # first item in loop
89                 ELSIF loop.last;
90                    # last item in loop
91                 ELSE;
92                    # any other item in loop
93                 END;
94               END
95           %]
96
97   Template::Namespace::Constants
98       The Template::Namespace::Constants module is used internally to
99       represent constants. These can be resolved immediately at the point
100       that a template is compiled.
101
102   Template::Parser
103       The Template::Parser module is used to parse a source template and turn
104       it into Perl code which can be executed.
105
106   Template::Plugin
107       The Template::Plugin module is a base class for Template Toolkit
108       plugins that can be loaded on demand from within a template using the
109       "USE" directive.
110
111   Template::Plugins
112       The Template::Plugins module is the plugins provider.  It loads and
113       prepares plugins as and when they are requested from within a template.
114
115   Template::Provider
116       The Template::Provider module is responsible for loading, compiling and
117       caching templates.
118
119   Template::Service
120       The Template::Service module implements a service layer that sits just
121       behind the Template module, and just in front of a Template::Context.
122       It handles each request to process a template (forwarded from the
123       Template module). It adds any headers and/or footers (specified via the
124       "PRE_PROCESS" and "POST_PROCESS" options), applies any wrapper (the
125       "WRAPPER" option) and catches any errors returned (the "ERRORS"
126       option).
127
128   Template::Stash
129       The Template::Stash module is used to fetch and store template
130       variables.  It implements all of the magic associated with the dot
131       operator.
132
133   Template::Stash::XS
134       The Template::Stash::XS module is a high-speed implementation of
135       Template::Stash written in C.
136
137   Template::Test
138       The Template::Test module is used to automate the Template Toolkit test
139       scripts.
140
141
142
143perl v5.38.0                      2023-07-21              Template::Modules(3)
Impressum