[%# # IMPORTANT NOTE # This documentation is generated automatically from source # templates. Any changes you make here may be lost. # # The 'docsrc' documentation source bundle is available for download # from http://www.template-toolkit.org/docs.html and contains all # the source templates, XML files, scripts, etc., from which the # documentation for the Template Toolkit is built. -%] [% META book = 'Modules' page = 'Filters' %] [% WRAPPER toc; INCLUDE tocitem title='SYNOPSIS'; INCLUDE tocitem title='DESCRIPTION'; INCLUDE tocitem title='METHODS' subs=['new(\%params) ', 'fetch($name, \@args, $context)']; INCLUDE tocitem title='CONFIGURATION OPTIONS'; INCLUDE tocitem title='TEMPLATE TOOLKIT FILTERS'; INCLUDE tocitem title='AUTHOR'; INCLUDE tocitem title='VERSION'; INCLUDE tocitem title='COPYRIGHT'; INCLUDE tocitem title='SEE ALSO'; END %] [% WRAPPER section title='SYNOPSIS' -%]
    use Template::Filters;
    $filters = Template::Filters->new(\%config);
    ($filter, $error) = $filters->fetch($name, \@args, $context);
[%- END %] [% WRAPPER section title='DESCRIPTION' -%]

The Template::Plugins module implements a provider for creating and/or returning subroutines that implement the standard filters. Additional custom filters may be provided via the FILTERS options.

[%- END %] [% WRAPPER section title='METHODS' -%][% WRAPPER subsection title = 'new(\%params) ' -%]

Constructor method which instantiates and returns a reference to a Template::Filters object. A reference to a hash array of configuration items may be passed as a parameter. These are described below.

    my $filters = Template::Filters->new({
	FILTERS => { ... },
    });
    my $template = Template->new({
	LOAD_FILTERS => [ $filters ],
    });

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

    $template = Template->new({
        FILTERS => { ... },
    });
[%- END %] [% WRAPPER subsection title = '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.

[%- END %] [%- END %] [% WRAPPER section title='CONFIGURATION OPTIONS' -%]

The following list details the configuration options that can be provided to the Template::Filters new() constructor.

[%- END %] [% WRAPPER section title='TEMPLATE TOOLKIT FILTERS' -%]

The following standard filters are distributed with the Template Toolkit.

[%- END %] [% WRAPPER section title='AUTHOR' -%]

Andy Wardley <abw@kfs.org>

[% ttlink('http://www.andywardley.com/', 'http://www.andywardley.com/') -%]

[%- END %] [% WRAPPER section title='VERSION' -%]

Template Toolkit version 2.01, released on 30th March 2001.

[%- END %] [% WRAPPER section title='COPYRIGHT' -%]
  Copyright (C) 1996-2001 Andy Wardley.  All Rights Reserved.
  Copyright (C) 1998-2001 Canon Research Centre Europe Ltd.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

[%- END %] [% WRAPPER section title='SEE ALSO' -%]

[% ttlink('Template', 'Template') -%], [% ttlink('Template::Context', 'Template::Context') -%]

[%- END %]