On Thu, Aug 16, 2001 at 11:18:46PM -0700, Craig Barratt wrote:
> It looks like TT2's Stash::set() will not set values in any blessed
> object (other than Template::Stash of course).  Assigning
> 
>     template.foo = 'bar'

It will - they get translated to calls of the form $template->foo('bar').
But in this case, $template, doesn't implement a 'foo' method or the
appropriate AUTOLOAD to handle it, so it is silently ignored.  At this
level, template should be considered a read-only item.

> BTW, the META directive allows you to modify the template object.
> Perhaps this does what you need?
> 
>     [% META foo = 'bar' %]

I think Tony's issue was that he wanted to check in a PRE_PROCESS or PROCESS
file if a template.value had been set by the appropriate META in the main
template.

The DEFAULT directive doesn't work because template is read-only, but
I typically do something like this:

  [% title = template.title or site.title %]


A



Reply via email to