Hi,

I'm on the beginnings of using TT so please bear with me - presumably 
there's an answer staring in my face somewhere so a pointer would be 
most appreciated...

Essentially, I may have a need to process a template repeatedly. So, I 
get the understanding that I can basically compile/cache a template so I 
can use that for best performance rather than re-reading the template in 
every call to (Template) process.

But I'm having trouble figuring out how that should be achieved in the 
best way. Looks to me I could use a Context object somehow but...well, I 
haven't made it yet. Or perhaps I'm just missing something obvious.

I'm assuming that rather than this:

my $tt = Template->new();
for (<a lot of iterations)
{
    $tt->process("file_with_big_template", $vars);
}

I should be able to do something like this instead:

my $ctt = <create an object which compiles file_with_big_template>;
for (<a lot of iterations)
{
    $ctt->process($vars);
}

And get a lot better efficiency.

I'm now prepared to say 'Duh!' when someone points out the part of the 
docs that describes this in great detail :-)

TIA,

ken1



_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to