[Catalyst] Template::Toolkit + Empty Lists

A. Pagaltzis pagaltzis at gmx.de
Tue Aug 1 09:53:12 CEST 2006


* Mark Blythe <list at markblythe.com> [2006-08-01 07:45]:
> Well, it turns out that the size will always be >= 1, because
> TT can't seem to handle an empty list.  If the method called
> (parent.children) returns an empty list, TT will substitute the
> return value with an empty string: '''.

Sorta.

TT really really wants to have anonymous data structures. It
doesn’t believe in lists. I think what happens is that an empty
list is coerced into a scalar somewhere in the internals and thus
spawns an undef that you end up seeing as an empty string. Maybe.
In any case, if you make sure that all functions/methods which
get called from a template return anonymous arrays (incl. empty
ones, when appropriate), then you won’t have problems like that.

(Have I mentioned that TT blows chunks? Because it does.)

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list