I have no experience with HTML::Template
, but I use Template Toolkit
for my templating needs. Skimming through the documentation of HTML::Template
, it seems to me that the Template Toolkit has a bit more features which support code/logic separation better, like default values of variables, and more sophisticated control structures.
There is in my opinion practically always a certain gray area where complete separation of code and presentation is impossible. I try to let the program logic be as generic and modular as possible, and let the template present return values from functions or objects in HTML.
What I tend to do in such cases is to build up an html string, and then feed that string, together with other tmpl outputs, to the template file.
I just give TT a bunch of scalars, arrays and/or hashes which I want to present in HTML, and let the templating engine deal with that.