[Templates] Template Tookit Vs HTML::Template

Brett Sanger swiftone@alumni.psu.edu
Fri, 15 Nov 2002 10:37:20 -0500


> I have to provide sound arguments as to why our prospective new system
> shouldn't move away from TT2 and use HTML::Template instead.  We have a

I moved from HTML::Template to TT2.  One feature was the primary reason:
Plugins.  Try much in HTML::Template, and they'll tell you to write a
filter.  Pretty soon every app will have a collection of filters --
sometimes, filters that are NOT directly related to your App!

As an example, I work a at a state office that often interacts with 121
town/county offices.  This list is used in a good number of apps in
different ways, sometimes for reasons not directly related to the app.
I can have a simple plugin to read these values from a DB and offer them
to the designer.  Thus, I don't have to repeat code in my apps, and if
the designer decides a page needs to include this listing for whatever
reason, they don't need to come to me to modify the app.  (The list does
change from time to time, thus the DB)

This happens in a few places.  Anything that would involve nasty
template code (either from TT or H::T) can be placed in a plugin for a
more centralized control, while letting the designers work on design.

> worried that TT2 provides too much flexibility to desigers in terms of the
> ability to destroy the system with huge loops and variable assignments, or
> whatever.  He also argues that HTML::Template has more caching options and

H::T can do huge loops and variable assignments.  A bad designer doesn't
even need a templating system to ruin your day.  This is a matter of job
duties, not tools.  IF you're running perl, this should be already
understood (speaking of flexibility :) ).  Not having to use filters to do
something as simple as including a template of variable name meant that
my code cleaned up.

> is faster, due to it's being smaller.  I've got the bulk of our developers

While I can't dispute that H::T is small and fast, when I switched I
didn't notice any speed change.  

> using TT2 over the last couple of months and it is active on several
> projects, however it's decision time for the way forward and I really

I have nothing against H::T, so long as you don't try to break it's
intention, and quite often people do need to break that goal.  (see
plugins/filters arguments above.)  This is one of those cases where your
decision comes down to two factors:

1) Which tools can do the job?
2) Which tools can you use?

Much like any language comparison.

One area where H::T people do do very well at is in keeping the
templates clean in philosophy.  That's why I'm still on the H::T list
despite not having a single bit of H::T code running.  The TT docs and
discussions often use templates that make me shudder.  (I also
occasionally write such things).  Listening to the H::T/CGI::App people
talk ensures that I keep the code/template border clean, and that my
ugly templates turn into plugins or modules.

> the covers.  What are the management advantages?  Does anyone have sources
> to point me towards, or experiences?

Only the experiences above.  I would say that I have only seen one or
two TT people moving to H::T, but I'm not the only one to go the other
direction.  (Then again, look at how many windows users there are)

-- 
SwiftOne
swiftone@alumni.psu.edu