A default Template::Filters module is created by the Template module if the LOAD_FILTERS option isn't specified. All configuration parameters are forwarded to the constructor.

$template = Template->new({
FILTERS => { ... },
});

fetch($name, \@args, $context)

Called to request that a filter of a given name be provided. The name of the filter should be specified as the first parameter. This should be one of the standard filters or one specified in the FILTERS configuration hash. The second argument should be a reference to an array containing configuration parameters for the filter. This may be specified as 0, or undef where no parameters are provided. The third argument should be a reference to the current Template::Context object.

The method returns a reference to a filter sub-routine on success. It may also return (undef, STATUS_DECLINE) to decline the request, to allow delegation onto other filter providers in the LOAD_FILTERS chain of responsibility. On error, ($error, STATUS_ERROR) is returned where $error is an error message or Template::Exception object indicating the error that occurred.

When the TOLERANT option is set, errors are automatically downgraded to a STATUS_DECLINE response.

use_html_entities()

This class method can be called to configure the html_entity filter to use the HTML::Entities module. An error will be raised if it is not installed on your system.

use Template::Filters;
Template::Filters->use_html_entities();

use_apache_util()

This class method can be called to configure the html_entity filter to use the Apache::Util module. An error will be raised if it is not installed on your system.

use Template::Filters;
Template::Filters->use_apache_util();

use_rfc2732()

This class method can be called to configure the uri and url filters to use the older RFC2732 standard for matching unsafe characters.

use_rfc3986()

This class method can be called to configure the uri and url filters to use the newer RFC3986 standard for matching unsafe characters.

CONFIGURATION OPTIONS

The following list summarises the configuration options that can be provided to the Template::Filtersnew() constructor. Please see Template::Manual::Config for further information about each option.

FILTERS

The FILTERS option can be used to specify custom filters which can then be used with the FILTER directive like any other. These are added to the standard filters which are available by default.