Andrew Sterling Hanenkamp
and 1 contributors


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:

Contentment::Plugin::Template settings

The first place the configuration information is loaded from is the Contentment::Plugin::Template settings. This generally holds the defaults.

%conf argument

The %conf argument passed to the new_template() method then contributes and overrides the values set so far.

"Contentment::Template::configuration" hook

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.

The last two bit sthere are always set and cannot be changed. This may change in the future.


Andrew Sterling Hanenkamp, <>


Copyright 2005 Andrew Sterling Hanenkamp <>. 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.