I am using Ubuntu Feisty with libtemplate-perl 2.14-1 on my development 
machine and Ubuntu Gutzy with libtemplate-perl 2.19-1 on my production 
machine (test now, soon production).

I have an object of type "User" with a "cards()"-method that returns a list 
(not an array ref, but a list) of cards, with type "Card", associated with a 
user. The user object is accessed through the "user" variable in my 
templates.

When the "cards()" method returns a single element I get an error telling me 
that there is no method called "Card::size".

This bug only hits in when there is a single card associated with the user, 
not with 0 or 2 or more cards.


Example usage in templates:
[% IF user.cards %]
        [% user.cards.size %] cards
[% END %]


I have also tried to call it like this without any luck:
[% user.cards.list.size %]


Just for the record, I am using Catalyst and the TTSite view (0.24 vs. 0.25), 
but I don't think it has anything to do with this because I call 
the "cards()"-method from the templates, regardless of how Catalyst is 
setting the "user" variable for use by Template Toolkit.


-- 
Knut-Olav Hoven
Systemutvikler               mob: +47 986 71 700
Linpro AS                    http://www.linpro.no/

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to