I like to keep control of the HTML that I write..

<AOL>Me too!</AOL>, but that being said, I never had been disappointed by the HTML output of CGI.pm. It's not as if you're using softwares like Dreamweaver, Frontpage or GoLive, which rely mostly on the inability of the user to actually write HTML, and thus output their own more or less mangled version of HTML.

CGI.pm on the other hand doesn't produce automatically HTML, you can mess up any way you want with the elements attributes (which is wrong), or put elements in the wrong places (TABLE tags in the HEAD, tags after the HTML ending, etc...). The big advantage of CGI.pm is to automatically generate valid XHTML, which is a Good Thing™.

For the speed question, everything comes at a price, and your process will use more resources to call the HTML tags from CGI than to simply print an interpolated string, but you usually doesn't have to worry about it as it is not a huge bottleneck (provided that you imported the html tags beforehand). If you already use CGI.pm in your script the overhead of generating the HTML is negligible, in my opinion.

If speed really matters, you should probably use mod_perl instead, with a Template-Toolkit handler. I have not tested this kind of configuration, but it should give quite good results

HTML Here-docs might be fine for small task, but if you have to generate tons of different pages with bazillions of different parameters for each, I'm not sure the guy who will eventually look up at your code later will appreciate that 4/5 of the program is embeded HTML with fragments of perl scattered all around...

<kbd>--
my $OeufMayo = new PerlMonger::Paris({http => 'paris.mongueurs.net'});</kbd>

In reply to Re: CGI.pm HTML shortcuts by OeufMayo
in thread CGI.pm HTML shortcuts by brpsss

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.