Cees Hek wrote:
> So can we expect this behaviour to remain in the future?  

Yes.

> The reason it works it is because VMethods are looked at before TT
> checks the type of variable it is working on.  I stumbled onto this
> because I had some objects that had a 'size' method that consistently
> failed to work correctly :)

The object methods *are* checked before vmethods.  So your object's
size() method should have been called in preference to the size()
VMethod.

Here's an example:

  package Foo;
  use base 'Class::Base';
  sub size { return "THE SIZE METHOD" }

  package main;
  use Template;
  Template->new->process(\*DATA, { foo => Foo->new() });

  __DATA__
  foo.size: [% foo.size %]

The result is:

  foo.size: THE SIZE METHOD

So I'm not sure why you didn't get the results you expected, but regular
methods definately get priority over VMethods.

Cheers
A



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

Reply via email to