Guys,

Just ran across a brief discussion of namespace handlers in the TT2 doco, and I wondered if that might be a reasonable solution for my previous problem? Just to refresh briefly, I have an object which has an overloaded '{}' operator, so that I can do this:

        $obj->{'fred'}

in my Perl code, but of course this:

        [% obj.fred %]

in my templates doesn't work because TT2 won't try out the hash deref unless ref returns 'HASH'.

So, assuming I can get all such vars into a particular namespace, could I write a namespace handler to do this? Would this be an acceptable (possibly even the "right") way to do this?

I also pondered submitting a patch for (I believe it was) Template::Stash--looks pretty basic to insert--if anyone thinks there's wider value in TT2 being able to handle overloaded objects like this.


-- Buddy

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

Reply via email to