There has been a lot of progress on adding TT's dot notation to HTML::Template.
Rhesa Rozendaal continues to make and release improvements to HTML::Template::Plugin::Dot. Recently he got support for TMPL_LOOP tags work as well.
Michael Peters soon added support to CGI::Application::Plugin::AnyTemplate.
Jason Crome released CGI::Application::Plugin::HTDot, which simply replaces CGI::Application's load_tmpl() with one that supports the dot notation.
Private, I received an inquiry if this will work with HTML::Template::Expr. That's not something I have looked to, but am interested to support.
For the next act, Rhesa is looking to some performance benchmarks to access
how this solution compares to others.
Re:the obvious question
mgraham on 2005-08-19T20:24:17
Personally, I use Template Toolit, but here's an attempt at a justification.
People often criticize Template Toolkit because it gives designers too much power. Other people criticize HTML::Template because it doesn't give designers enough power.
Personally, I think that the best solution is somewhere between the two extremes. I'm happy that people are adding small but powerful features to HTML::Template, and I'd be happy if people added small feature restrictions on TT. For instance, I hear someone has made it possible to disable the USE directive in Template Toolkit. I think that's a great new feature.
With TT, the worry is that the designer will use every bit of power you give them and so eventually, they will end up sticking full programs inside the templates.
With HT, the concern is that the programmer will have to anticipate a lot of design issues and will end up writing a lot of design related code.
A good example is date formatting. The programmer wants to add today's date to the template, but doesn't know what format the designer will want. So the programmer pre-fills a bunch of formats and allows the designer to pick one:
$self->template->fill({
date_mdy => $date->mdy,
date_ymd => $date->ymd,
date_iso => $date->strftime('%F'),
});Then the designer picks the one they want, e.g.
<TMPL_VAR NAME="date_mdy">But the designer can only pick a format from the ones available, and they have to guess at the programmer's naming convention for each one.
With HT::Dot, you do it the TT way:
$self->template->fill({
date => $date,
});
<TMPL_VAR NAME="date.hms">This makes it a lot easier to program for HTML::Template, without giving the designer all the power of Template Toolkit.
Of course this means it is also now possible to cause more harm:
<TMPL_VAR NAME="user.delete">But it's not as though you can do this:
[% USE DBI('dbi:driver:dbname', 'user', 'pass') %]
[% DBI.do("UPDATE users SET firstname='gordon'") %]Michael
Disclaimer: I wrote CGI::Application::Plugin::AnyTemplate, so in technology discussions I tend towards the mushy middle.