1Dancer2::Template::ImplUesmeerntCaotnitDoranin:bc:ueFtroe2rd:k:ePTdeeTrmilpnlyDa(ot3ce)u:m:eInmtpalteimoenntation::ForkedTiny(3)
2
3
4

NAME

6       Dancer2::Template::Implementation::ForkedTiny - Dancer2 own
7       implementation of Template::Tiny
8

VERSION

10       version 0.207000
11

SYNOPSIS

13         my $template = Dancer2::Template::Implementation::ForkedTiny->new(
14             TRIM => 1,
15         );
16
17         # Print the template results to STDOUT
18         $template->process( <<'END_TEMPLATE', { foo => 'World' } );
19         Hello [% foo %]!
20         END_TEMPLATE
21

DESCRIPTION

23       Dancer2::Template::Implementation::ForkedTiny is a reimplementation of
24       a subset of the functionality from Template Toolkit in as few lines of
25       code as possible.
26
27       It is intended for use in light-usage, low-memory, or low-cpu
28       templating situations, where you may need to upgrade to the full
29       feature set in the future, or if you want the retain the familiarity of
30       TT-style templates.
31
32       For the subset of functionality it implements, it has fully-compatible
33       template and stash API. All templates used with
34       Dancer2::Template::Implementation::ForkedTiny should be able to be
35       transparently upgraded to full Template Toolkit.
36
37       Unlike Template Toolkit, Dancer2::Template::Implementation::ForkedTiny
38       will process templates without a compile phase (but despite this is
39       still quicker, owing to heavy use of the Perl regular expression
40       engine.
41
42   SUPPORTED USAGE
43       By default, the "[% %]" tag style is used. You can change the start tag
44       and end tag by specifying them at object creation :
45
46         my $template = Dancer2::Template::Implementation::ForkedTiny->new(
47             start_tag => '<%',
48             end_tag => '%>,
49         );
50
51       In the rest of the documentation, "[% %]" will be used, but it can be
52       of course your specified start / end tags.
53
54       Both the "[%+ +%]" style explicit whitespace and the "[%- -%]" style
55       explicit chomp are support, although the "[%+ +%]" version is unneeded
56       in practice as Dancer2::Template::Implementation::ForkedTiny does not
57       support default-enabled "PRE_CHOMP" or "POST_CHOMP".
58
59       Variable expressions in the form "[% foo.bar.baz %]" are supported.
60
61       Appropriate simple behaviours for "ARRAY" references, "HASH" references
62       and objects are supported. "VMethods" such as [% array.length %] are
63       not supported at this time.
64
65       If the resulting expression is a CodeRef, it'll be evaluated.
66
67       "IF", "ELSE" and "UNLESS" conditional blocks are supported, but only
68       with simple "[% foo.bar.baz %]" conditions.
69
70       Support for looping (or rather iteration) is available in simple "[%
71       FOREACH item IN list %]" form is supported. Other loop structures are
72       not supported. Because support for arbitrary or infinite looping is not
73       available, Dancer2::Template::Implementation::ForkedTiny templates are
74       not turing complete. This is intentional.
75
76       All of the four supported control structures
77       "IF"/"ELSE"/"UNLESS"/"FOREACH" can be nested to arbitrary depth.
78
79       The treatment of "_private" hash and method keys is compatible with
80       Template Toolkit, returning null or false rather than the actual
81       content of the hash key or method.
82
83       Anything beyond the above is currently out of scope.
84

NAME

86       Dancer2::Template::Implementation::ForkedTiny - Template Toolkit
87       reimplemented in as little code as possible, forked from Template::Tiny
88

METHODS

90   new
91         my $template = Dancer2::Template::Implementation::ForkedTiny->new(
92             TRIM => 1,
93         );
94
95       The "new" constructor is provided for compatibility with Template
96       Toolkit.
97
98       The only parameter it currently supports is "TRIM" (which removes
99       leading and trailing whitespace from processed templates).
100
101       Additional parameters can be provided without error, but will be
102       ignored.
103
104   process
105         # DEPRECATED: Return template results (emits a warning)
106         my $text = $template->process( \$input, $vars );
107
108         # Print template results to STDOUT
109         $template->process( \$input, $vars );
110
111         # Generate template results into a variable
112         my $output = '';
113         $template->process( \$input, $vars, \$output );
114
115       The "process" method is called to process a template.
116
117       The first parameter is a reference to a text string containing the
118       template text. A reference to a hash may be passed as the second
119       parameter containing definitions of template variables.
120
121       If a third parameter is provided, it must be a scalar reference to be
122       populated with the output of the template.
123
124       For a limited amount of time, the old deprecated interface will
125       continue to be supported. If "process" is called without a third
126       parameter, and in scalar or list contest, the template results will be
127       returned to the caller.
128
129       If "process" is called without a third parameter, and in void context,
130       the template results will be "print()"ed to the currently selected file
131       handle (probably "STDOUT") for compatibility with Template.
132

SUPPORT

134       Bugs should be reported via the CPAN bug tracker at
135
136       <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Template-Tiny>
137
138       For other issues, or commercial enhancement or support, contact the
139       author.
140

AUTHOR

142       Adam Kennedy <adamk@cpan.org>
143
144       Forked and improved by Damien Krotkine <dams@cpan.org>
145

SEE ALSO

147       Config::Tiny, CSS::Tiny, YAML::Tiny
148
150       Copyright 2009 - 2011 Adam Kennedy.  Copyright 2012 Damien Krotkine.
151
152       This program is free software; you can redistribute it and/or modify it
153       under the same terms as Perl itself.
154
155       The full text of the license can be found in the LICENSE file included
156       with this module.
157

AUTHOR

159       Dancer Core Developers
160
162       This software is copyright (c) 2018 by Alexis Sukrieh.
163
164       This is free software; you can redistribute it and/or modify it under
165       the same terms as the Perl 5 programming language system itself.
166
167
168
169perl v5.28.0                  Danc2e0r128:-:1T1e-m1p4late::Implementation::ForkedTiny(3)
Impressum