On Tue, 13 Mar 2007, Dave Howorth wrote:

In the context of the original question, it's also worth remembering
that an object is not the same as a hash as far as TT is concerned. It
unifies the syntax to call accessors and to access the members of a
hash. But it does *not* let you access arbitrary elements in a blessed
hash as Perl does. In TT, you can only use the methods.

Huh? That's not true at all. In fact, TT2 does exactly the opposite. If I do this in my template:

 [% object.something %]

It tries to call a method something() on that object. However, if that method does not exist and the object is a blessed hash, then TT2 "helpfully" looks up "something" as a hash key. Of course, if that key does not exist, TT2 will "helpfully" just keep going without a warning or error. This helpful behavior has cost me many hours of debugging.

And yes, I know there's a mode for TT2 where you can make it barf on any instance of undef in a template substitution, but that's often _too_ strict.


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to