Bill Moseley wrote:
 > I noticed this in some old code (where "cart") is a Class::DBI object:
 >
 >     items = cart.items;
 >     count = items.size;

Hi Bill,

I suspect this is the "culprit".

#------------------------------------------------------------------------
# Version 2.14a - 2nd February 2006               ## DEVELOPER RELEASE ##
#------------------------------------------------------------------------

* Activated a patch in Template::Stash from Stephen Howard which adds
   code for the full set of fallbacks for dot ops called against
   objects which don't implement the specific method.  For example
   [% hashobj.vmethod %] [% listobj.2 %] and [% listobj.vmethod %] now
   all work with the Perl Template::Stash.  Added code to the XS Stash
   to do the same and updated tests.

   http://template-toolkit.org/pipermail/templates/2003-December/005417.html

TT is now calling the hash.size virtual method, whereas in 2.14 and earlier
it couldn't find the hash.size virtual method so automagically upgraded the
single record to a list and called the list.size vmethod instead.

In this case you can put a .list on the end of cart.items to explicitly
upgrade a single item to a list:

   items = cart.items.list

HTH
A

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

Reply via email to