Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Re: lighter alternative to CGI.pm

by perrin (Chancellor)
on Aug 29, 2002 at 19:17 UTC ( [id://193867]=note: print w/replies, xml ) Need Help??


in reply to Re: lighter alternative to CGI.pm
in thread lighter alternative to CGI.pm

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 CGI.pm
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.

    Cheers,
    Ovid

    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 CGI.pm. 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.

        cheers

        tachyon

        s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://193867]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-18 08:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found