I have been using HTML::Template extensively for my current project
(this week) and there are some questions and comments I have about it.
First off, I enjoy using it tremendously :) .. I have combined it with
CGI::Session and the two together are very useful. I also really like
the flexibility of the caching architecture ... I am producing a package
for unknown environments, so it was nice to still be able to use some
form of caching via file_cache that is pretty much guaranteed to work
anywhere perl does :).
I am glad that the filtering option exists ... I have actually used it
to produce a mini-framework for programmers who use the application I
am writing to be able to add custom tags to HTML::Template. I have used
JSP taglibs to a limited extent and I would like to see a framework for
easily defining tag classes added to HTML::Template. My code is a bit
of a hack as I needed to pass in more than just the filter text to my
tag lib framework .. I wanted the tag libs to get the current CGI object
and CGI::Session object too, along with the complete filename of the
template being worked on.
My first use of this was to produce a select list tag that will create a
list from an external file .. again, my application will be given to
an audience that may or may not know perl but will know at least some
HTML ... so my tag is
<TMPL_SELECT NAME="xxxx" FILE="xxxx">
This will create the list from the file (file has one option per line,
path is relative to the directory of the template) and also set the
selected element to the current value of either 1) the variable in the
CGI object or 2) the variable in the session ... or none if neither
The real hack part of my framework is that I had to also pass in the
template filename so that for files that contain the custom tags I can
update the mtime/atime so that HTML::Template will create them over
again each time it comes across the file. This was the only way I could
think to avoid having HTML::Template filter my file once then not touch
it again ... therefore completely overriding the purpose of my custom
So ... my ideal situation would be to have a taglib framework that would
be separate from the filtering to let programmers easily extend and add
new tags to HTML::Template without affecting the core .. which would lead
to easy tag sharing too .. something I would like to see :).
I was planning on mentioning other things but I think I have written
enough for now :).
Any comments/feedback welcome. I would be happy to discuss/work with
someone to add this to HTML::Template if it is deemed to be a feature
that is wanted.