The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Chronicle::Template - Base class for Chronicle's template abstractions

DESCRIPTION

This class should be used as a base class for Template plugins and provides a few utility methods for writing those. For users of the template plugins, it also provides the factory method create that takes care of loading and instantiating the required subclass.

METHODS

new

The constructor takes a file name as a mandatory agument and a number of options as key-value pairs. The following options are currently defined:

theme_dir Where to look for themes
theme Name of the theme to use

LICENSE

This module is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version, or

b) the Perl "Artistic License".

AUTHOR

Matthias Bethke

new

Constructor.

create

This factory method takes the template text or file name as the only mandatory parameter and returns an instance of a Chronicle::Template subclass. A number of optional parameters may follow as key-value pairs. All of these options are passed to the subclass' constructor except for type. type specifies the desired subclass; default is "HTMLTemplate" for compatibility with the old hardcoded templates.

The following values are currently valid for type:

HTMLTemplate
Xslate

param

Add a parameter that can be used in template expansion later. Takes a key and a value to add.

output

This method takes no parameters and returns the final rendering result from applying all arguments set by param to the template.

_theme_file_path

Construct a path to a theme file from a filename passed in and the theme_dir and theme specified at construction time. Returns undef if the file does not exist or is not readable.

_theme_dir

Construct a path to the theme dir and check that it exists. Returns the diretory on success, undef otherwise.