Solved the problem by using a custom stash (example attached) and
overriding the get method.  As a side note, also needed to override the
private _assign method due to a line in Template::Stash that read

    if ($rootref eq 'HASH' || $rootref eq __PACKAGE__) {

which i needed to translate to

    if ($rootref eq 'HASH' || UNIVERSAL::isa($root, __PACKAGE__)) {

to inherit the Template::Stash object.
Cheers
-Dave

----- Original Message -----
From: darren chamberlain <[EMAIL PROTECTED]>
Date: Wednesday, November 13, 2002 5:25 am
Subject: Re: [Templates] auto filtering

> * Mark Fowler <[EMAIL PROTECTED]> [2002-11-12 11:20]:
> > On Tue, 12 Nov 2002, Andy Wardley wrote:
> > > You could write a custom stash which puts a wrapper around the 
> > > get() method, filtering all the output that it returns.
> > 
> > Putting it at the stash level seems to be a mistake to me...you 
> often> want to manipulate the data and do a lot of stuff and not 
> have to
> > worry about filtering it until the last matter.
> 
> I came to exactly the same conclusion when I decided to spend a few
> minutes trying to implement it.
> 
> > Since we're talking about being lazy here, I'd probably 
> implement it
> > as an option to auto filter interpolated variables.  So in this
> > example:
> > 
> >   This is a [% foo %] with very many $bar.
> > 
> > foo would not be filtered, but $bar would be.  This seems to 
> give you
> > the right degree of balance between convenience and flexibility.
> 
> Interesting... as long as we can assume that we're talking about HTML.
> I would hate for my GD images to be HTML encoded, for example.  That's
> why filters are optional, and need to be specified explicitly.
> 
> (darren)
> 
> -- 
> How can I believe in God when just last week I got my tongue 
> caught in
> the roller of an electric typewriter?
>    -- Woody Allen
> 
> _______________________________________________
> templates mailing list
> [EMAIL PROTECTED]
> http://lists.ourshack.com/mailman/listinfo/templates
> 

Attachment: MyStash.pm
Description: Binary data

Reply via email to