|Think about Loose Coupling|
CGI.pm Disillusionmentby Cody Pendant (Prior)
|on Jun 05, 2003 at 00:11 UTC||Need Help??|
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.