in reply to Re: lighter alternative to
in thread lighter alternative to

Thanks. I don't suppose anyone has ever compared CGI::Simple to CGI_Lite?

The server is using the ISAPI Perl DLL. Taint-checking? I wish. This is someone else's legacy code, and it doesn't even use strict. I'm hacking out my own little island of clean code in the middle of it, with hopes of eventually expanding to conquer the rest.

Replies are listed 'Best First'.
Re: Re: Re: lighter alternative to
by Ovid (Cardinal) on Aug 29, 2002 at 19:29 UTC

    I'm not aware of any comparisons. I like CGI::Simple because it's a drop-in replacement. Converting your code will be ridiculously simple. Since CGI_Lite does not share the same interface you have a longer conversion time and a greater likelyhood of bugs.

    One feature of CGI_Lite that you have to contend with is the setting of the OS type to determine line endings with file uploads. If someone simply hardcodes the OS in there, you now have non-portable code.

    I just took a look at the CGI_Lite code and spotted a bug. The separator for query strings is defined in the module as an ampersand. It should also support a semi-colon as that's the recommended separator -- though I confess that few use it.

    I also noticed that the CGI_Lite::is_dangerous() method skips the null byte. Oh wait! It's not even a method, it's a function, so you can't subclass it. If you need to subclass it (though it sounds like you don't), you'd have to reimplement all of the functions in there that don't pass $self as the first argument.

    All in all, CGI_Lite looks like a nice module, but I see some issues with it that could stand some fixing.


    Update: I just noticed that the is_dangerous function also explicitly returns a zero for false. While I think it's clear that this is to be called in a scalar or boolean contect, if someone were to accidentally assign the results to an array, the array would automatically evaluate as true. Boolean responses should have a bare return for false, but now I think I'm just getting picky. It still appears to be a very useful module.

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

      I just tested it, and for the very minor use that I'm putting it to CGI::Simple is actually slower than I'm a little bit boggled by this result, but I guess it's just a matter of the particular functions I'm using. CGI_Lite, on the other hand, gives about a 60% speed increase in the overall execution time of the script.

        I would like to see your code as all the testing I did showed that CGI::Simple was quite a bit faster than CGI across the board. I too am boggled.