I spent a couple of hours last night trying to "respectablize" some old Perl scripts.

I have learned much at the feet of my fellow PerlMonks, and now feel rather embarassed at: scripts which can't be run under strict; clunky HTML solutions; non-module form parsing routines and so on.

So last night I went over a script which was a mishmash of HERE documents and print statements and reformed it using CGI.pm.

It really did take a couple of hours, even for a simple script, because I was unfamiliar with the module. Apart from anything else, it seems inconsistent. I can pretty much make any HTML tag I want by just using it (BLOCKQUOTE isn't mentioned in the documentation, but can simply be used like all other tags), but form fields have names that don't relate directly to their HTML names at all, like "textfield".

Anyway, I went through the rather monkish procedure of editing code that already works just fine and removing from it any non-CGI code for rendering HTML/dealing with parameters. Mostly I was just wanting to use the "stickiness" of form fields, because I wanted a form which would re-display with values intact if one of them was missing.

So what does that leave me with:

I'm not saying I hate CGI.pm, but I'm a bit disillusioned. Am I missing something? What have I gained for my two hours? Do I just need another coffee? And how can I get CGI.pm to produce valid HTML 4.01 Strict or XHTML 1.0 or whatever in future?
--

“Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.”
M-J D

In reply to CGI.pm Disillusionment by Cody Pendant

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.