Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
It seems that there is always a knee-jerk reaction to not having control flow in your HTML - and sometimes rightfully so. I very often see posters decrying systems such as Template::Toolkit because it has its own language - which it does - which may or may not be a problem. But that is a separate issue from that introduced by the Tal, Seamstress, and now the "Empty" concept.

The problem introduced by Tal, Seamstress, this new "Empty", and sometimes even HTML::Template with its "LOOP" construct - is that the Perl code has to know too much about the template.

Obviously the Perl code has to know which variables the template is going to need. However the Tal and Seamstress models go a little further - the Perl code for these has to know a little (sometimes a lot) about how the template is going to present the data. We've made sure the logic is out of the presentation layer - but now we've made the code layer manipulate the presentation layer. I think this is worse than having control flow in the template.

The nice thing about template systems with at least a minimal amount of language capability (such as Template::Toolkit) is that my Perl layer can generate data and pass it to the presentation layer. The presentation layer is then free to manipulate the data into a form suitable for presentation.

In the end, it really is developer preference. But for myself I've found that Template::Toolkit syntax and particularly Template::Alloy (which I authored) if used properly are the perfect separation between model and view. And it is the perfect separation from both directions.

my @a=qw(random brilliant braindead); print $a[rand(@a)];

In reply to Re: RFC - Template::Empty by Rhandom
in thread RFC - Template::Empty by redhotpenguin

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (5)
    As of 2017-11-24 18:40 GMT
    Find Nodes?
      Voting Booth?
      In order to be able to say "I know Perl", you must have:

      Results (352 votes). Check out past polls.