in reply to HTML::Template - what's the rule of thumb?

One of the uses of Template::HTML is to allow the separation of (e.g. html) content and (perl) code.
You really mean HTML::Template ;-) Maybe you should update your topic for future searchability sake.

That said, yes, not only "one of the uses," it could be argued that the only use, rather, objective of H::T is to separate display from code. In most sites, however, it is not possible to achieve 100% separation. For example, if you are displaying rows from a table (a common implementation in most dynamic sites) you want to colorize the rows with alternating light/dark colors to improve legibility. Obviously, you will need a teensy bit of logic in the template to be able to do it.

However, separation of display is not only for aesthetic purposes but also for granting the ability to edit/design/improve the aesthetics to those who are right-brain endowed but might be coding-challenged. Right person for the right job.

Also, what about the right tool for the right job? Most coders would agree that a simple to muscular text editor is the best tool for coding. But doing CSS, layout and site design is probably better accomplished with something like GoLive or Dreamweaver or other such. For example, all these visual tools provide the ability to diagram the site with its various linkages and whatnot.

Based on the above understanding, I maximize the power of H::T by designing different templates for different outputs. I try to design a site where if I were to open up only the .tmpl files in GoLive, it would still appear as a site. Or, were I to navigate through a structure of .tmpl files using a browser, I would still be able to "walk" through the shell site.

Needless to say, there will be common elements that may want to populate the entire site with -- well, the TMPL_INCLUDE tag and the filter option in H::T rise up happily to the occasion. With judicious use of these capabilities you can maximize the power of H::T, design a site which can, if required, be handed to someone who is really skilled at making it good-looking while you can concentrate on working on the grey matter.

I believe the above would be helpful even if you yourself were the right and left brains of your coding team of one.

Hope this meta-discussion helps you in your coding. In the end, there is no rule of thumb. If it works for you, it works.

  • Comment on Re: Template::HTML - what's the rule of thumb?