I noticed this in some old code (where "cart") is a Class::DBI object:

    items = cart.items;
    count = items.size;

I ran it on my dev machine and noticed that it was reporting a count
of eleven when it should be just one item.  Then I ran on an old
machine with 2.14 (which is probably when that application was
written) and it reports just one item.

    Dumper.dump( items )

shows me that's it's just a single object, and there seems to be
eleven hash keys in the blessed hash.

I also noticed a stash entry for "as_list":

 sub { return ref($_[0]) eq 'ARRAY' ? shift : [ shift ] };

So, seems like I should have:

    count = as_list( items ).size;


I'm trying to remember, is that the usual approach?





-- 
Bill Moseley
[EMAIL PROTECTED]


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

Reply via email to