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.


In reply to Re: Template::HTML - what's the rule of thumb? by punkish
in thread HTML::Template - what's the rule of thumb? by kiat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.