[Templates] how to recompiling template in each call of Template->process

Sharad Pratap sh4r4d at gmail.com
Thu Jun 19 14:15:12 BST 2008


Hi All,
I am new user to ttk, I need to process aa mail text for different people in
a loop
but I am getting only first value of that loop, I seen in Template::Manual,
Template::Stash, Template::Context, ...
tried, but not getting solution.
Here is the simple program text,
================================\/================================
#!/bin/env perl
use Template;
our $template = Template->new();
our $txt,
our %var;
foreach ( qw/ a b c d e f / ) {
  $var{"x"} = $_;
  $template->process(\*DATA, \%var, \$txt);
  print "value expected ", $_, "\n";
  print $txt;
}
__END__
value really comming [% x %]
================================/\================================

I am getting output

value expected a
value really comming a
value expected b
value really comming a
......
value expected f
value really comming a

I want it
value expected a
value really comming a
value expected b
value really comming b
......
value expected f
value really comming f

Please help to tell how I can get this correct or desired.
-- 
Regard,
Sharad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.template-toolkit.org/pipermail/templates/attachments/20080619/38088087/attachment.htm 


More information about the templates mailing list