1Template::Alloy::HTE(3)User Contributed Perl DocumentatioTnemplate::Alloy::HTE(3)
2
3
4

NAME

6       Template::Alloy::HTE - HTML::Template and HTML::Template::Expr roles.
7

DESCRIPTION

9       The Template::Alloy::HTE role provides syntax and interface support for
10       the HTML::Template and HTML::Template::Expr modules.
11
12       Provides for extra or extended features that may not be as commonly
13       used.  This module should not normally be used by itself.
14
15       See the Template::Alloy documentation for configuration and other
16       parameters.
17

HOW IS Template::Alloy DIFFERENT FROM HTML::Template

19       Alloy can use the same base template syntax and configuration items as
20       HTE and HT.  The internals of Alloy were written to support TT3, but
21       were general enough to be extended to support HTML::Template as well.
22       The result is HTML::Template::Expr compatible syntax, with Alloy speed
23       and a wide range of additional features.
24
25       The TMPL_VAR, TMPL_IF, TMPL_ELSE, TMPL_UNLESS, TMPL_LOOP, and
26       TMPL_INCLUDE all work identically to HTML::Template.
27
28       •   Added support for other TT3 directives and for TT style "dot
29           notation."
30
31               <TMPL_SET a = "bar">
32               <TMPL_SET b = [1 .. 25]>
33               <TMPL_SET foo = PROCESS 'filename.tt'>
34
35               <TMPL_GET foo>  # similar to <TMPL_VAR NAME="foo">
36               <TMPL_GET b.3>
37               <TMPL_GET my.nested.chained.variable.1>
38               <TMPL_GET my_var | html>
39
40               <TMPL_USE foo = DBI(db => ...)>
41               <TMPL_CALL foo.connect>
42
43           Any of the TT directives can be used in HTML::Template documents.
44
45           For many die-hard HTML::Template fans, it is probably quite scary
46           to be providing all of the TT functionality.  All of the extended
47           TT functionality can be disabled by setting the NO_TT configuration
48           item.  The NO_TT configuration is automatically set if the SYNTAX
49           is set to "ht" and the output method is called.
50
51       •   There is an ELSIF!!!
52
53               <TMPL_IF foo>
54                 FOO
55               <TMPL_ELSIF bar>
56                 BAR
57               <TMPL_ELSE>
58                 Done then
59               </TMPL_IF>
60
61       •   Added CHOMP capabilities (PRE_CHOMP and POST_CHOMP)
62
63               Foo
64               <~TMPL_VAR EXPR="1+2"~>
65               Bar
66
67               Prints Foo3Bar
68
69       •   Added INTERPOLATE capability
70
71               <TMPL_SET foo = 'FOO'>
72               <TMPL_CONFIG INTERPOLATE => 1>
73               $foo <TMPL_GET foo> ${ 1 + 2 }
74
75               Prints
76
77               FOO FOO 3
78
79       •   Allow for HTML::Template templates to include TT style templates.
80
81               <TMPL_CONFIG SYNTAX => 'tt3'>
82               <TMPL_INCLUDE "filename.tt">
83
84       •   Allow for Expr parsing to follow proper precedence rules.
85
86              <TMPL_VAR EXPR="1 + 2 * 3">
87
88              Properly prints 7.
89
90       •   Uses all of the caching and opcode tree optimizations provided by
91           Template::Alloy and Template::Alloy::XS.
92
93       •   Alloy does not provide the query method from HTML::Template.  This
94           is because parsing of the document is delayed until the output
95           method is called, and because Alloy supports TT style chained
96           variables which often are not resolvable until run time.
97

UNSUPPORTED HT CONFIGURATION

99       die_on_bad_params
100           Alloy does not resolve variables until the template is output.
101
102       force_untaint
103       strict
104           Alloy is strict on parsing HT documents.
105
106       shared_cache, double_cache
107           Alloy doesn't have shared caching.  Yet.
108
109       search_path_on_include
110           Alloy will check the full path array on each include.
111
112       debug items
113           The HTML::Template style options are included here, but you can use
114           the TT style DEBUG and DUMP directives to do introspection.
115
116       max_includes
117           Alloy uses TT's recursion protection.
118
119       filter
120           Alloy doesn't offer these.
121

ROLE METHODS

123       "register_function"
124           Defines a new function for later use as text vmethod or top level
125           function.
126
127       "clear_param"
128           Empties the parameter list.
129
130       "query"
131           Not supported.
132
133       "new_file"
134           Creates a new object that will process the passed file.
135
136               $obj = Template::Alloy->new_file("my/file.hte");
137
138       "new_scalar_ref"
139           Creates a new object that will process the passed scalar ref.
140
141               $obj = Template::Alloy->new_scalar_ref(\"some template text");
142
143       "new_array_ref"
144           New object that will process the passed array (each item represents
145           a line).
146
147               $obj = Template::Alloy->new_array_ref(\@array);
148
149       "new_filehandle"
150               $obj = Template::Alloy->new_filehandle(\*FH);
151
152       "parse_tree_hte"
153           Called by parse_tree when syntax is set to ht or hte.  Parses for
154           tags HTML::Template style.
155
156       "param"
157           See Template::Alloy.
158
159       "output"
160           See Template::Alloy.
161

AUTHOR

163       Paul Seamons <paul@seamons.com>
164

LICENSE

166       This module may be distributed under the same terms as Perl itself.
167
168
169
170perl v5.38.0                      2023-07-21           Template::Alloy::HTE(3)
Impressum