Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: Re: lighter alternative to CGI.pm

by Ovid (Cardinal)
on Aug 29, 2002 at 19:29 UTC ( #193877=note: print w/replies, xml ) Need Help??


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

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.

  • Comment on Re: Re: Re: lighter alternative to CGI.pm

Replies are listed 'Best First'.
CGI_Lite vs. CGI::Simple
by perrin (Chancellor) on Aug 29, 2002 at 20:16 UTC
    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

        All it does is load CGI_Lite and parse cookies. Nothing else.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2021-04-12 03:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?