On Fri, Mar 05, 2004 at 12:34:19PM -0500, Mark Mills wrote:
> Well, returning an empty list pretty much ends the game for hacking 
> around in Stash OPs. 

After thinking about it a while I guessed that was going to be the case.

> So what you'd need to do is this:
> my $tt = Template->new({
>    FILTERS =>{ zero=>sub { return $_[0] ? $_[0] : "0" },
>    }
> );
> $tt->process(\*DATA => {
>  mylist => sub { return () },
> });
> And try [% mylist.size|zero %]

That's not going to work for passing the value around (to CGI.x or macro
calls etc) though - I'd need to assign it somewhere first before doing
that. And if I'm going to do that I may as well just do 
  [% SET val = mylist.size + 0 %]
with no need for an extra filter...

I guess there's not much I can do beyond wrapping that in a MACRO.

Thanks,

Tony


_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to