in reply to Re: Best practices: Generating HTML content
in thread Best practices: Generating HTML content
my $var; my $template = Template->new; $template->process( \'In-place [% foo %] query', { foo => 42 }, \$var +);
It comes with a performance penalty though as TT does not cache compiled in-memory templates by default.
UPD As 1nickt mentions, the penalty can be overcome by compiling the template explicitly:
my $tt = Template->new; my $compiled = $tt->template( \'In-place [% foo %] query' ); $template->process( $compiled, { foo => 42 }, \$var );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Best practices: Generating HTML content
by Your Mother (Archbishop) on Dec 24, 2017 at 16:50 UTC | |
|
Re^3: Best practices: Generating HTML content
by 1nickt (Canon) on Dec 24, 2017 at 17:35 UTC | |
by Dallaylaen (Chaplain) on Dec 24, 2017 at 18:03 UTC |