Bill Ward wrote:
> On 7/25/07, Matisse Enzer <[EMAIL PROTECTED]> wrote:
>> How do get Template Toolkit to throw an exception if it encounters a
>> call to a non-existent method?
>>
>> In the following example  zoo   is an object, but there is no
>> get_animals()  method - so I want TT to throw an exception at that
>> point.
>>
>>             [% FOREACH animal IN zoo.get_animals %]
> 
> Everyone's suggesting ways to work around your problem... but I think
> this is a flaw in Template.  I thought it was the case that if foo is
> an object, then foo.bar is the bar method, or if foo is a hash, and
> foo.bar is the value corresponding to the key bar.  But apparently, if
> foo is an object implemented as a hash that lacks a bar method,
> Template is looking up the value corresponding to the key bar.

Apparently? Does that mean you have test code that shows this behaviour?
If so, could you post it please. The test code I have doesn't show it,
and IIRC the usual complaint on this list is from people who can't
access hash elements in objects that aren't exposed via methods.

Cheers, Dave

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

Reply via email to