Separation of data generation and view code is good, as you already have stated, so no need to discuss that.

Using a templating engine makes sense only if:

Another reason could be wanting to have a visual distinction between model/controller and view code.

Using a non-perl templating language brings benefits only if you need to discipline yourself to use only a subset of what is possible in perl. As merlyn has put it -

It's not so much a restriction as merely a place where it starts getting interestingly harder.

I don't consider the edge-of-road markers that make a very loud noise in my car when I start to drift a "restriction" either. After all, I can ignore the noise, and keep driving off to the emergency shoulder, as I might need to do occasionally. However, it's a nice warning that I need to rethink what I'm doing.

So, if you have to "fight your tool" you either have a design flaw, or the tool is inappropriate for the task.

I don't buy the argument that

$authors[$index]->{$book}->{title}

is less readable than

authors.index.book.title

In the latter,no clue is given about what each token is; perl sigils actually increase readability.

It is not too hard to explain the meaning of sigils in perl. It is not too hard to explain what brackets and curlies mean. The sigils give a clue of what each token is, and it is a feature of perl we all love. Why not propagate that appreciation to non-perl coders?

Anyways, if "the html whackers" don't grok that, they shouldn't probably touch embedded code at all - be it perl or some other language.

The argument of "language independency" doesn't hold. What other languages implement e.g. Template's placeholder language? or that of HTML::Template ?

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

In reply to Re: The hidden charm of Template::Toolkit (and templates generally) by shmem
in thread The hidden charm of Template::Toolkit (and templates generally) by roman

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.