NAME Mojolicious::Plugin::TemplateToolkit - Template Toolkit renderer plugin for Mojolicious SYNOPSIS # Mojolicious $app->plugin('TemplateToolkit'); $app->plugin(TemplateToolkit => {name => 'foo'}); $app->plugin(TemplateToolkit => {template => {INTERPOLATE => 1}}); # Mojolicious::Lite plugin 'TemplateToolkit'; plugin TemplateToolkit => {name => 'foo'}; plugin TemplateToolkit => {template => {INTERPOLATE => 1}}); # Set as default handler $app->renderer->default_handler('tt2'); # Render without setting as default handler $c->render(template => 'bar', handler => 'tt2'); DESCRIPTION Mojolicious::Plugin::TemplateToolkit is a renderer for tt2 or Template Toolkit templates. See Template and Template::Manual for details on the Template Toolkit format. Mojolicious helpers and stash values will be exposed directly as variables in the templates, and the current controller object will be available as c or self, similar to Mojolicious::Plugin::EPRenderer. See Mojolicious::Plugin::DefaultHelpers and Mojolicious::Plugin::TagHelpers for a list of all built-in helpers. $c->stash(description => 'template engine'); $c->stash(engines => [qw(Template::Toolkit Text::Template)]); [% FOREACH engine IN engines %] [% engine %] is a [% description %]. [% END %] [% link_to('Template Toolkit', 'http://www.template-toolkit.org') %] [% c.param('foo') %] Unless set with the "template" option, the configuration settings INCLUDE_PATH and ENCODING will be set to the values of "paths" in Mojolicious::Renderer and "encoding" in Mojolicious::Renderer when the plugin is registered, so make sure to set these attributes before registering the plugin if needed. OPTIONS Mojolicious::Plugin::TemplateToolkit supports the following options. name # Mojolicious::Lite plugin TemplateToolkit => {name => 'foo'}; Handler name, defaults to tt2. template # Mojolicious::Lite plugin TemplateToolkit => {template => {INTERPOLATE => 1}}; Configuration values passed to Template object used to render templates. METHODS Mojolicious::Plugin::TemplateToolkit inherits all methods from Mojolicious::Plugin and implements the following new ones. register $plugin->register(Mojolicious->new); $plugin->register(Mojolicious->new, {name => 'foo'}); Register renderer in Mojolicious application. BUGS Report any issues on the public bugtracker. AUTHOR Dan Book COPYRIGHT AND LICENSE This software is Copyright (c) 2015 by Dan Book. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible) SEE ALSO Mojolicious::Renderer, Template