The way I usually accomplish that is by introducing a namespace, i.e.:
my $ttvars = {
title => ''
};
$tt->process($tmpl, { ttvars => $ttvars }, \$out);
In the template I would write:
[% SET ttvars.title = 'foo bar' %]
then $ttvars->{title} contains the correct value in Perl code.
-M.
Lee.M wrote:
> Hello TT friends,
>
> I want to do this:
>
> my $var = '';
>
> $tt->process($tmplt, { var => \$var}, $out);
>
> print "var is now $var\n"; # var is now new value
>
> and allow the template to set its value
>
> [% var = 'new value' %] just changes it from a scalar reference to a
> string
>
> is there anyway to accomplish this pseudo code:
>
> [% ${var} ='new value' %]
>
>
> TIA!
>
> _______________________________________________
> templates mailing list
> [email protected]
> http://mail.template-toolkit.org/mailman/listinfo/templates
>
>
--
www.dynarchlib.com - the mighty AJAX toolkit
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates