Generally no. TT will see [% obj %] as an instance of the pertinent
class, not as a hash reference.
You could make [% obj.item('foo') %] work simply by defining a method
called "item" for it.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Josh
Rosenbaum
Sent: Tuesday, November 07, 2006 4:52 PM
To: Dami Laurent (PJ)
Cc: [email protected]
Subject: Re: [Templates] differentiating hash entries / methods with
same name
Dami Laurent (PJ) wrote:
> Hi all,
>
> Suppose an object $obj has both a hash entry $obj->{foo} and a method
> $obj->foo().
>
> If I pass this object to a template, [% obj.foo %] performs a method
call.
>
> Is there a way to access the hash entry instead?
>
> Thanks in advance, L. Dami
>
Does obj.item('foo') work?
-- Josh
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates