Contentment::Template - Setup Template Toolkit for use by Contentment
use Contentment::Template; my %conf = ( TRIM => 1, INTERPOLATE => 1, EVAL_PERL => 1, ); my $tt = Contentment::Template->new_template(%conf); $tt->process(\$template, { foo => 'bar', baz => 'qux' }) or die $tt->error;
This is a factory class for constructing Contentment compatible Template Toolkit template parsers. This may be used by your code to provide some custom templating. It was originally created to help facilitate the use of the Contentment::Form module and it's recommended use.
The factory constructs an object of class Template using configuration information pulled from a number of sources. That configuration is merged as follows:
The first place the configuration information is loaded from is the Contentment::Plugin::Template settings. This generally holds the defaults.
The %conf argument passed to the new_template() method then contributes and overrides the values set so far.
%conf
new_template()
Each of these hook handlers is called and passed a reference to the current configuration. These hooks are then given the opportunity to modify the configuration.
The "LOAD_TEMPLATES" option is set to an array containing only a reference to Contentment::Template::Provider.
The "OUTPUT" option is always set to the STDOUT file handler.
STDOUT
The last two bit sthere are always set and cannot be changed. This may change in the future.
Andrew Sterling Hanenkamp, <hanenkamp@cpan.org>
Copyright 2005 Andrew Sterling Hanenkamp <hanenkamp@cpan.org>. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To install Contentment, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Contentment
CPAN shell
perl -MCPAN -e shell install Contentment
For more information on module installation, please visit the detailed CPAN module installation guide.