Template::Alloy::TT(3pm) User Contributed Perl Documentation Template::Alloy::TT(3pm)

Template::Alloy::TT - Template::Toolkit role

The Template::Alloy::TT role provides the syntax and the interface for Template::Toolkit version 1, 2, and 3. It also brings many of the features from the various templating systems.

And it is fast.

See the Template::Alloy documentation for configuration and other parameters.

Alloy uses the same base template syntax and configuration items as TT2, but the internals of Alloy were written from scratch. Additionally much of the planned TT3 syntax is supported as well as most of that of HTML::Template::Expr. The following is a list of some of the ways that the configuration and syntax of Alloy are different from that of TT2. Note: items that are planned to work in TT3 are marked with (TT3).

Template::Alloy has its own mechanism for loading and storing compiled templates. TT would use a Template::Provider that would return a Template::Document. The closest thing in Template::Alloy is the load_template method. There is no immediate plan to support the TT behavior.
Template::Alloy uses its own mechanism for loading plugins. TT would use a Template::Plugins object to load plugins requested via the USE directive. The functionality for doing this in Template::Alloy is contained in the list_plugins method and the play_USE method. There is no immediate plan to support the TT behavior.

Full support is offered for the PLUGINS and LOAD_PERL configuration items.

Also note that Template::Alloy only has native support for the Iterator plugin. Any of the other plugins requested will need to provided by installing Template::Toolkit or the appropriate plugin module.

Template::Alloy uses its own mechanism for loading filters. TT would use the Template::Filters object to load filters requested via the FILTER directive. The functionality for doing this in Template::Alloy is contained in the list_filters method and the play_expr method.

Full support is offered for the FILTERS configuration item.

This option is used by the LOAD_TEMPLATES and LOAD_PLUGINS options and is not applicable in Template::Alloy.
Template::Alloy has no concept of service (theoretically the Template::Alloy is the "service").
Template::Alloy provides its own pseudo context object to plugins, filters, and perl blocks. The Template::Alloy model doesn't really allow for a separate context. Template::Alloy IS the context.
Template::Alloy has its own built in parser. The closest similarity is the parse_tree method. The output of parse_tree is an optree that is later run by execute_tree. Alloy provides a backend to the Template::Parser::Alloy module which can be used to replace the default parser when using the standard Template::Toolkit library.
Template::Alloy maintains its own grammar. The grammar is defined in the parse_tree method and the callbacks listed in the global $Template::Alloy::Parse::DIRECTIVES hashref.

Paul Seamons <paul@seamons.com>

This module may be distributed under the same terms as Perl itself.

2022-10-16 perl v5.36.0