[Templates] Proposed change to splice vmethod

John Ingram john@funnycow.com
Fri, 20 Apr 2007 09:36:19 -0700


On 4/20/07, Andy Wardley <abw@wardley.org> wrote:
> Yes, there is a difference in that you get an empty list rather than
> an empty value.

I hadn't thought about it that way.   I looked a little more into
perl's splice() and I see that it returns undef if no values are
removed from the list -- so that would probably be more appropriate
for the change if it were going to occur.   Thanks for the workaround,
also.

John

> One workaround is to add an "AND item.size" condition at the end:
>
>    [% WHILE (item = mylist.splice(0,2)) AND item.size %]
>
> I'll have a think about the implications of changing the vmethod to
> return an empty value.  But either way, it'll be something for TT3.
>
> Cheers
> A
>