Actually, it seems that using just one more layer of indirection works:
$vars = { foo => { bar => 'original foo.bar' }};
...
and in the template: [% foo.bar = 'new foo.bar' %]
I see this as being useful for, say, building HTML email with embedded images.
For example, any template that produced a <IMG SRC="cid:XXX"> tag
could also add XXX to a list returned to the perl caller. That would
allow the perl code to know what images are referenced by the template
and need to be attached to the email.
There still might be an issue with a template invoked with INCLUDE
being able to access the top-level stash. hmmm...
On Thu, Jan 21, 2010 at 4:50 PM, Perrin Harkins <[email protected]> wrote:
> On Thu, Jan 21, 2010 at 5:17 PM, E R <[email protected]> wrote:
>> When using a simple hash for the template variables object, it doesn't
>> seem that a template can modify it, e.g.
>
> Is this a physics experiment? The data changes when it is observed?
>
> Seriously, it sounds like you're trying to do non-display programming
> in TT instead of in Perl, which is usually a bad idea.
>
> - Perrin
>
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates