On Tue, 2006-11-07 at 14:47 +0100, Dami Laurent (PJ) wrote:
> 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?
You could pass in a sub ref to do it:
hash => sub { $_[0]->{$_[1]}; }
and then in the template:
[% hash(obj, "foo") %]
- Perrin
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates