[Templates] auto filtering

Andy Wardley abw@andywardley.com
Tue, 12 Nov 2002 15:08:53 +0000


Jonas Liljegren wrote:
> No. That would destroyt all the markup.
> 
> It should only filter all the GET things.

OK, I understand now.

Unfortunately, I can't think of an easy way to implement it.

You could write a custom stash which puts a wrapper around the 
get() method, filtering all the output that it returns.

But I wouldn't want to add such filtering to the default stash because
it would add a penalty to all those times when you don't want filtering
on.  The stash is definately the bottleneck of TT and I don't want to 
make it even a little bit narrower.

Another alternative might be to implement a custom directive generator
which adds the perl code to filter each value returned from the stash.
This could be implemented using the new NAMESPACE feature which enables
things like compile time constant folding.  But again, it's non-trivial.

I'll think about it some more.  Other suggestions welcome.

A