Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dancer::template::templatetoolkit(3pm) [debian man page]

Dancer::Template::TemplateToolkit(3pm)			User Contributed Perl Documentation		    Dancer::Template::TemplateToolkit(3pm)

NAME
Dancer::Template::TemplateToolkit - Template Toolkit wrapper for Dancer DESCRIPTION
This class is an interface between Dancer's template engine abstraction layer and the Template module. This template engine is recomended for production purposes, but depends on the Template module. In order to use this engine, use the template setting: template: template_toolkit This can be done in your config.yml file or directly in your app code with the set keyword. Note that by default, Dancer configures the Template::Toolkit engine to use <% %> brackets instead of its default [% %] brackets. This can be changed within your config file - for example: template: template_toolkit engines: template_toolkit: start_tag: '[%' stop_tag: '%]' You can also add any options you would normally add to the Template module's initialization. You could, for instance, enable saving the compiled templates: engines: template_toolkit: COMPILE_DIR: 'caches/templates' COMPILE_EXT: '.ttc' By default, Template is used, but you can configure Dancer to use a subclass with the "subclass" option. engines: template_toolkit: subclass: My::Template WRAPPER, META variables, SETs Dancer already provides a WRAPPER-like ability, which we call a "layout". The reason we do not use TT's WRAPPER (which also makes it incompatible with it) is because not all template systems support it. Actually, most don't. However, you might want to use it, and be able to define META variables and regular Template::Toolkit variables. These few steps will get you there: o Disable the layout in Dancer You can do this by simply commenting (or removing) the "layout" configuration in the config.yml file. o Use Template Toolkit template engine Change the configuration of the template to Template Toolkit: # in config.yml template: "template_toolkit" o Tell the Template Toolkit engine who's your wrapper # in config.yml # ... engines: template_toolkit: WRAPPER: layouts/main.tt Done! Everything will work fine out of the box, including variables and META variables. SEE ALSO
Dancer, Template AUTHOR
This module has been written by Alexis Sukrieh LICENSE
This module is free software and is released under the same terms as Perl itself. perl v5.14.2 2012-01-27 Dancer::Template::TemplateToolkit(3pm)

Check Out this Related Man Page

Template::Stash::XS(3pm)				User Contributed Perl Documentation				  Template::Stash::XS(3pm)

NAME
Template::Stash::XS - High-speed variable stash written in C SYNOPSIS
use Template; use Template::Stash::XS; my $stash = Template::Stash::XS->new(\%vars); my $tt2 = Template->new({ STASH => $stash }); DESCRIPTION
The Template:Stash::XS module is an implementation of the Template::Stash written in C. The "XS" in the name refers to Perl's XS extension system for interfacing Perl to C code. It works just like the regular Perl implementation of Template::Stash but runs about twice as fast. The easiest way to use the XS stash is to configure the Template Toolkit to use it by default. You can do this at installation time (when you run "perl Makefile.PL") by answering 'y' to the questions: Do you want to build the XS Stash module? y Do you want to use the XS Stash by default? y See the INSTALL file distributed with the Template Toolkit for further details on installation. If you don't elect to use the XS stash by default then you should use the "STASH" configuration item when you create a new Template object. This should reference an XS stash object that you have created manually. use Template; use Template::Stash::XS; my $stash = Template::Stash::XS->new(\%vars); my $tt2 = Template->new({ STASH => $stash }); Alternately, you can set the $Template::Config::STASH package variable like so: use Template; use Template::Config; $Template::Config::STASH = 'Template::Stash::XS'; my $tt2 = Template->new(); The XS stash will then be automatically used. If you want to use the XS stash by default and don't want to re-install the Template Toolkit, then you can manually modify the "Template/Config.pm" module near line 42 to read: $STASH = 'Template::Stash::XS'; BUGS
Please report bugs to the Template Toolkit mailing list templates@template-toolkit.org AUTHORS
Andy Wardley <abw@wardley.org> <http://wardley.org/> Doug Steinwand <dsteinwand@citysearch.com> COPYRIGHT
Copyright (C) 1996-2012 Andy Wardley. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Template::Stash perl v5.14.2 2012-01-13 Template::Stash::XS(3pm)
Man Page