Template::Process - Process TT2 templates against data files
use Template::Process; $tt = Template::Process->new(); # VARS $tt->process(TT => 'h.tt.html', DATA => 'vars.yml', OUT => 'h.html') or die $tt->error;
This module implements a facility to process TT2 scripts against data files, so that applying simple templates to simple data involves no coding.
This is the heart of the tt script (which comes in the same distribution).
$tt = Template::Process->new;
The constructor.
$tt->process(TT => $tt, DATA => \@data, OUT => $out);
The elements at @data may be: hash refs, YAML and Perl filenames. A YAML filename is expected to exist (-f $_ returns true) and match /\.ya?ml$/. A Perl filename must satisfy -f $_ and match /\.PL$/.
@data
-f $_
/\.ya?ml$/
/\.PL$/
If DATA is ommitted, the template is processed with no extra variables.
DATA
If OUT is ommitted, \*STDOUT is used.
OUT
\*STDOUT
$tt->process(@ARGS) or die $tt->error;
In case of processing errors, returns a (hopefully) helpful message.
None at all. This is OO.
ttree (from Template-Toolkit distribution)
Adriano Ferreira, <ferreira@cpan.org>
Copyright (C) 2006-2007 by Adriano Ferreira
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Template::Process, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Process
CPAN shell
perl -MCPAN -e shell install Template::Process
For more information on module installation, please visit the detailed CPAN module installation guide.