Re: Template Toolkit Cache should do the trick. It allows templates to be read from memory instead of from disk.
Update: Some code:
use Template qw( ); use Template::Provider::Memory qw( ); my %mem_drive = ( 'layout' => [ time(), <<'__EOI__' ], <p>hello, [% name %] [% content %] <p>goodbye, [% name %] __EOI__ 'somepage' => [ time(), <<'__EOI__' ], <title>Some Page</title> [% WRAPPER layout %] <p>This is the body of the page. [% END %] __EOI__ ); my $tt = Template->new({ LOAD_TEMPLATES => [ Template::Provider::Memory->new({ MEM_DRIVE => \%mem_drive }), Template::Provider->new(), ], }); my $vars = { name => 'Dave', }; my $output; $tt->process('somepage', $vars) or die($tt->error(), "\n");
The module and the var need a better name.
In reply to Re^3: Yet Another Stupid TT Question
by ikegami
in thread Yet Another Stupid TT Question
by pileofrogs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |