Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of markjugg (792)

Tuesday August 02, 2005
06:24 PM

Patch to add TT's dot notation to HTML::Template

[ #26049 ]
Last night I hacked in support for the basics of TT's "dot notation" for template variables into HTML::Template.

Here's my patch with code and tests, but no docs yet.

For those just tuning into the templating competition, one of the cool features of TT is that you can reference a value in a deeply nested hash or a chain of method calls directly in the template with the dot notation, like this:

    my_hash.deeply_nested.sage_brush
    my_obj.has.chained.methods_galore

In the code only have to make the single hashref or object available to make this work:

my_hash => \%foo,
my_obj  => $obj,

I don't see that this violates the philosophy of HTML::Template, because from the designers perspective, hardly anything as changed. Before they had a list of tmpl_vars to work with, and now they have the same thing, but the life of the programmer is easier.

I have begun discussing how to best release this functionality with Sam Tregar, and expect to involve the mailing list now that Gmane is available for me to post again. At this point, I think having it in the core, in a sub-class or as a plugin (for a yet-to-be-developed) plugin system are all possibilities.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.