in reply to TT & templates from data?
TT's process method will happily work with data from a scalar, you just have to pass a reference to the template text (so that it knows it's not a file name).
use Template; my $tt = Template->new( ); my $data = { foo => 'bar' }; $tt->process( \qq{[% foo %]\n[% FOR i IN ['A'..'Z'] %][% i %]\n[% END +%]}, $data, \*STDOUT );
I do this all the time putting the template source after the __END__ marker and then slurping it into a scalar from DATA. Or you could get fancy and use Inline::Files.
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
|---|