Almost everyone agrees that anything fairly sizeable should use some kind of templating system. For small projects, there are three schools of thought:

  1. Good ol' print statements
  2. CGI.pm's HTML generation
  3. Go right to a templating system regardless of the size

The print statement way is almost certainly the least maintainable, but maybe that won't be an issue for a small CGI. Using CGI.pm's HTML generation has a large following (not the least of which is merlyn). People of the other two schools often think that CGI.pm should only be about input processing and should ditch the HTML generation into a seperate module. However, there is probably too much code using the current system to change it now.

I personally favor going right to a templating system (unless its a really quick-and-dirty job). Its probably the most maintainable, but will almost certainly take longer to get it done the first time through (depending on the complexity of the templating system you use).

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated


In reply to Re: use CGI or die, even with mod_perl? by hardburn
in thread use CGI or die, even with mod_perl? by Massyn

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.