Re: CGI modules?
by brian_d_foy (Abbot) on Jan 28, 2006 at 21:36 UTC
|
For really lightweight things, I liked CGI::Request, but that seems to have disappeared from the world (except when bundled with other packages). It has the same interface as CGI but doesn't have the extra cruft. It looks like CGI::Lite has taken over that spot. If you want to do vanilla CGI insetead of mod_perl stuff, you won't be able to use Apache::Request.
| [reply] |
|
|
Thanks for all the replies. I guess I'll go for CGI::Lite. But assuming the server does have mod_perl, is Apache::Request any faster?
BTW, I'm making a web app and I'm trying to make it somewhat portable. So I might still end up using CGI.pm, or even worse, writing it in PHP.
| [reply] |
|
|
Well, mod_perl is a lot faster because you don't have to start perl over and over again. If you decide to use mod_perl later, options such as PerlRun will still make your scripts pretty quick without having to change anything.
| [reply] |
|
|
|
|
Re: CGI modules?
by merlyn (Sage) on Jan 28, 2006 at 23:54 UTC
|
What's wrong with CGI.pm? It's dynamically loaded, so anything you don't use, you don't pay for. Just ignore the parts of it you don't need. And of all the modules, it's clearly the most mature, well-used, well-documented, and plenty of examples, not to mention being installed everywhere.
| [reply] |
|
|
CGI::Simple is a drop-in replacement for the CGI parsing part of CGI.pm, avoids dealing in HTML generation, passes all of CGI.pm’s applicable tests, plus an additional large batch of its own, has a much smaller and much cleaner codebase, and is quite a bit faster. I say, why not?
Makeshifts last the longest.
| [reply] |
|
|
CGI::Simple seems to be exactly what I'm looking for, thanks. And one more question, what are the differences between CGI::Lite and CGI::Simple? x_x
| [reply] |
|
|
Re: CGI modules?
by Fletch (Bishop) on Jan 28, 2006 at 20:57 UTC
|
Well, for one thing Apache::Request requires that you're running under mod_perl, not CGI.
| [reply] |
Re: CGI modules?
by derby (Abbot) on Jan 28, 2006 at 23:02 UTC
|
| [reply] |
Re: CGI modules?
by Adrade (Pilgrim) on Jan 28, 2006 at 20:40 UTC
|
If cookie data is all you're looking for, you can use something like this - I pulled this from a package I wrote for something or another. This is by no means comprehensive, but I dont require anything more complicated than this.
I tend to also favor a slightly modified version of the old cgi-lib, in favor of CGI.pm, but I still use the latter for dealing with file input.
I think that sometimes, its just easier, especially if your need is very limited, to sort of pull together your own subroutines to handle stuff.
Hope this helps,
-Adam
-- By a scallop's forelocks!
| [reply] [d/l] |
|
|
| [reply] |
|
|
I agree that its most definately not for complicated usage... it was put in place in a situation in which I didnt have to handle anything beyond one key that was being passed in... its given as a rudimentary example, and something that could suffice (as it does for me) in situations that require very basic parsing. I did notice the simplicity of %cookies = parse CGI::Cookie($ENV{COOKIE}); from CGI::Cookie, which seems quite lovely indeed. For whatever reason, I have a tendency to limit loading in modules when I don't really need all their features, and given the use for which this was constructed, I still probably wouldn't change it, however duely noting your very pleasant alternative for future applications.
Thanks,
-Adam
-- By a scallop's forelocks!
| [reply] [d/l] |