Any-Renderer

 view release on metacpan or  search on metacpan

lib/Any/Renderer/Template.pm  view on Meta::CPAN


An B<Any::Template> format is also provided.  This uses the default backend (as specified in the ANY_TEMPLATE_DEFAULT environment variable).

=head1 METHODS

=over 4

=item $r = new Any::Renderer::Template($format,\%options)

See L</FORMATS> for a description of valid values for C<$format>.
See L</OPTIONS> for a description of valid C<%options>.

=item $scalar = $r->render($data_structure)

The main method.

=item $bool = Any::Renderer::Template::requires_template($format)

This will be true for these formats.

=item $list_ref = Any::Renderer::Template::available_formats()

This will discover the formats supported by your Any::Template installation.

=back

=head1 OPTIONS

=over 4

=item Template (aka TemplateFilename)

Name of file containing template.  Mandatory unless TemplateString is defined.

=item TemplateString

String containing template.  Mandatory unless Template or TemplateFilename is defined.

=item NoCache

Suppress in-memory caching of templates loaded from the filesystem.

=item TemplateOptions

A hashref of options for the backend templating engine.  

If C<TemplateOptions> is not explicitly specified, 
all options passed to this module that are not recognised will be passed through
Any::Template (via the C<Options> constructor option) to the backend templating engine for the rendering process.
This flatter options structure may be more convenient but does introduce the risk of a nameclash between an option name in an obscure back-end templating module 
and an option specific to Any::Render::Template - it's your choice.

Further information on the options for each backend module can be found in the documentation for Any::Template::$backend 
or the documentation for the backend templating module itself.

=back

=head1 GLOBAL VARIABLES

The package-level template cache is created on demand the first time it's needed.
There are a few global variables which you can tune before it's created (i.e. before you create any objects):

=over 4

=item $Any::Renderer::Template::CacheMaxItems

Maximum number of template objects held in the cache.  Default is 1000.

=item $Any::Renderer::Template::CacheMaxAtime

Items older than this will be purged from the cache when the next purge() call happens.  In Seconds.  Default is 6 hours.

=item $Any::Renderer::Template::CachePurgeInterval

How often to purge the cache.  In Seconds.  Default is 1 hour.

=back

=head1 ENVIRONMENT

Set the C<ANY_RENDERER_AT_SAFE> environment variable to a true value if you want to check each Any::Template 
backend compiles before adding it to the list of available formats.
This is safer in that modules with missing dependencies are not advertised as available but it incurs a
CPU and memory overhead.

=head1 SEE ALSO

L<Any::Template>, L<Any::Renderer>, L<Cache::AgainstFile>

=head1 VERSION

$Revision: 1.21 $ on $Date: 2006/09/04 12:15:53 $ by $Author: johna $

=head1 AUTHOR

Matt Wilson and John Alden <cpan _at_ bbc _dot_ co _dot_ uk>

=head1 COPYRIGHT

(c) BBC 2006. This program is free software; you can redistribute it and/or modify it under the GNU GPL.

See the file COPYING in this distribution, or http://www.gnu.org/licenses/gpl.txt

=cut



( run in 0.696 second using v1.01-cache-2.11-cpan-e1769b4cff6 )