On Jul 8, 2008, at 2:01 PM, 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' %]

I can use a coderef to assign to it and return; but I was hoping for a  
built in way to do this :)

$tt->process($tmplt, { set_var => sub { $var = $_[0];return; } }, $out);

[% set_var('new value') %]

Is there a built in TT way to do that?

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

Reply via email to