Since I discovered CGI.pm, I've used it for everything HTML-related that I have to do. I tend to embed tag functions 10-20 deep, which prodocues remarkably concise code. This confuses the hell out of coworkers not used to functional programming, but properly indented, it can make perfect sense. As a result, the code is much more maintainable and infinitely more flexible. Tables especially are vastly simplified by using CGI. Need to change the color of a cell? Do it in one place, not everywhere you have a <TD>. I recently went back to a script I wrote using a combination of hard HTML with Perl buried inside; I had never updated the script because I hadn't been able to decipher what it did anymore. I finally decided to reimplement it from scratch using CGI, and now it's a breeze to change.

As for efficiency, I've never noticed any slowdown, even with complex table-embedded forms and such. However, I don't manage any sites with huge traffic so I've never bothered to do any benchmarks. My intuition would be that the slowdown would be certainly detectable if you tried to notice it, but probably not fatal.

If speed is a completely critical issue, try it both ways and do the benchmarks; you may need to do the hard HTML. But if it's not, absolutely get comfortable with CGI.pm; you'll love yourself for it down the road.


In reply to Re: HTML with CGI.pm by athomason
in thread HTML with CGI.pm by Ovid

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.