Sherm Pendley said:
My biggest beef with CGI.pm is that it isn't focused. It takes a "shotgun"
approach of providing everything that might be useful in the most common
case of input from and output to HTML forms. Thus, it includes a boatload
of HTML form-generation methods that have *nothing* to do with the Common
Gateway Interface.
That is/was my problem with CGI.pm as well. Far too many html-ish features,
while not bad should probably go to something like HTML or have something
like CGI::HTML inherit CGI for the folks who want it.
Having said that, I think it's absolutely wonderful that people have the
freedom to write CGI any darn way they feel like it.
As I understand it, those methods are autoloaded, so there's hardly any
penalty for them at run-time. My dislike of them is conceptual - a module
called "CGI.pm" should focus on CGI, while something that concerns itself
with a particular type of markup that can be generated and sent to a client
belongs in a separate module. And the HTML-related methods *do* clutter up
the documentation, even though they don't cause any performance penalty.
True, it's usually a conceptual thing with me too. I'm not slamming CGI.pm
for any reason, I've heard Lincoln Stein give presentations and I respect
him very much. The impression I got was that he wanted it to be the best
possible general-purpose module available for CGI work, at the time it was
written, CGI generally involved writing HTML code.
So, I prefer to use CGI::Lite when that's available.
I'm lazy.
I either use CGI, or I roll my own.
Sometimes I think it'd be a "neat thing" if I could use 'event handlers' when
parsing CGI, especially when uploading files. (say you're uploading a huge tab
file, the event handlers could parse it while it's being uploaded and insert
it into a DBM or something, but ONLY for certain specific variables.)
Or, it'd be kind of cool to have your own CGI module that accepts weird
content-type's so that (for example) it could accept an XML-RPC type of
document and convert it into the familiar param(), or the other-way-round,
take urlencoded data and by way of naming conventions and such, convert it
into an XML-RPC style message.
I could probably think of many many more uses for doing it yourself, perhaps
the main reason is simply because you find it fun.
This whole thread really degrades into the 3 camps, those who like using
modules in their code, those who perfer to get their hands dirty, and those
who want to explore alternative ways.
As far as posting buggy code to this newsgroup, if I'm reading it, I'd rather
NOT look at all the checks for content-length and so forth unless it is the
heart of whatever problem there is. One might post a:
# .. check input for security problems ..
Just to make people aware that you're aware of it, but I'd perfer to cut out
all irrelevant code where possible to make it easier to focus in on a problem.
(this is my preference, I know others disagree, thats the cool thing about
freedom, we're allowed to do that.
)
Jamie