The reason why it makes sense to use an entirely different language for the templates is quite simply to avoid using Perl. You may be very proficient in writing Perl code, but quite often the people who deal with the templates (and in general the 'View' part of the equation) are web designers. Those people are more likely to be better at HTML and CSS, and it therefore makes more sense to teach them how to use a simple template syntax (% s.name %) instead of teaching Perl (print $s{name}).
Even if all your web designers are Perl hackers, I think it still makes sense to learn a different templating language just for the sake of code clarity. I find it much easier to do all the hard work in my Perl in my Controller class, shove those variables in the stash (I use Catalyst), and then simply print and loop through the variables with the Template Toolkit.
All in all, TT is a very powerful system, and a language of its own. I once designed an entire web page that didn't need any "real" dynamic content, so I didn't have to write one line of Perl code: the whole thing was developed using Template toolkit and the ttree helper application.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|