http://qs321.pair.com?node_id=145776


in reply to RFC CGI.pm refactoring

I'm reading through a lot of these posts and I'm a little disheartened. Let's face it, tachyon isn't exactly coming to us with a 10 line CGI parsing routine and saying "should I upload to CPAN?". He asked for some feedback and in my mind, that translates to a code review, but many appear to object without reviewing the code! There was some limited support for this, but again, without apparently reviewing the code.

CGI.pm is a wonderful "don't leave /home without it" sort of module. However, it does have some significant issues that warrant competition. CGI::Lite seems to be well-regarded as is Apache::Request. Is that it, though? Is this all that we allow in the club? CGI::Simple seems to be a promising way of overcoming many of the typical "I won't use CGI.pm" objections.

A while ago, tachyon and I were talking about this and I reviewed his code. While I made a couple of suggestions, for the most part, I liked what I saw. What really impresses me about this effort is that, with just under 1000 unit tests (going by what tachyon said), he states that this module passes 100% of the tests. Note that these include all of the CGI.pm tests. So, if the test suite is complete, we have 100% backwards compatibility with a lightweight, well-written module. I think that's something to consider.

Yeah, we can say that "CGI.pm" works, don't use anything else, but what does that get us? Stagnation. Let's try new things. Let's experiment. Even if this code offered no advantages other than much cleaner internals, it should be worth considering on that basis alone, not just dismissed out of hand, as some here seem to have done.

This isn't to say that we all need to rush forward and embrace what tachyon has done, but I think we should give it more consideration that what has been done here. Let's look at the features:

Now, if you have to have those HTML generating functions, don't use CGI::Simple. Frankly, I use those HTML generating functions if I'm doing something really, really minor. Otherwise, though, I use templates. If I use templates, CGI::Simple perfectly fits my needs. If this gets to the CPAN, I'm really going to give this module some serious consideration.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.