My interest is in generating HTML.

It seems to me that if one is using CGI.pm then one will probably not use Template-Toolkit very often, because their approaches are different.

CGI.pm aims to turn HTML tags into perl functions. Thus Print p('hello') generates the appropriate paragraph tags.

Template-toolkit, on the other hand, aims to leave markup as is and turn perl into markup. For instance, instead of saying in CGI.pm

if (condition){ print p('hello'); }
it appears that one would say
[% IF condition %] <p>hello</p> [% end %]

In cgi.pm, everything, including output, is a perl statement. In template-toolkit, nothing in the template is a perl statement, and all output appears through the template.

In my view, combining the two approaches would be very,very confusing.

Am I correct that those who use CGI.pm to generate a page do not also use template-toolkit at the same time to generate it?


In reply to Re: All Hail the Template Toolkit! by sierrathedog04
in thread All Hail the Template Toolkit! by clemburg

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.