cgi-lib.pl vs CGI.pm? 
Author Message
 cgi-lib.pl vs CGI.pm?

Hey folks,

I've been seeing an overwhelming amount of referance to CGI.pm in CLPM lately,
and have been wondering if there would be a major shift in value added in me
switching to it (aside from the obvious benefit of understanding more of the
articles in CLPM :).

Currently, I've been using cgi-lib.pl by Steven E. Brenner, which handles a lot
of the mundane tasks of CGI quite nicely. Are there any overwhelming reasons to
switch to CGI.pm? I went as far as to print out the docs on CGI.pm (or the
source, I can't remember which), but for whatever reason put it on the back
burner and kept on trundling along with cgi-lib.pl.

Comments appreciated!

--
Marc Bissonnette
InternAlysis
Corporate Internet Research and Results!
http://www.*-*-*.com/



Sun, 25 Mar 2001 03:00:00 GMT  
 cgi-lib.pl vs CGI.pm?


Quote:
>The only main advantage I've found in using CGI.pm is the ability to run
>scripts from the command line. This is, honestly, quite useful. Now that
>CGI.pm is part of the standard distribution, I find myself using it more
>and more, but if you're happy with cgi-lib.pl, I wouldn't be in a huge
>rush to upgrade.

The main advantage to me is to dynamically create HTML (especially
form fields, and tables) using array/hash references. very sweet. It
makes elegant code when parsing data from a database query.  It allows
you to easily maintain state across many page requests of a complex
form, etc..., etc...,

I agree, if all you need now is access to the http parameters passed
to your perl script, then it is not necessary to switch. But, if you
ever want to do something more complex (and you will someday), you are
going to need CGI.pm.

jay



Mon, 26 Mar 2001 03:00:00 GMT  
 cgi-lib.pl vs CGI.pm?

+ I'm in the minority around here, but I say if it works, don't "fix" it.
+ There are supposedly some bugs in cgi-lib.pl, although I've never
+ encountered them. I gather that they have something to do with file
+ uploads. If (like me) you're using cgi-lib primarily to parse the input
+ from HTML forms, and it does what you need it to, I see no reason to
+ change. I have no problem printing out my own html, either. :)

Its not like changing is particularly hard, or even dangerous. Change:

require "cgi-lib.pl";

to:

use CGI qw(:cgi-lib);

and you get all the functionality of CGI.pm's compatibility mode.

James



Mon, 26 Mar 2001 03:00:00 GMT  
 cgi-lib.pl vs CGI.pm?

Quote:


> + I'm in the minority around here, but I say if it works, don't "fix" it.
> [ ... ]

> Its not like changing is particularly hard, or even dangerous. Change:

> require "cgi-lib.pl";

> to:

> use CGI qw(:cgi-lib);

> and you get all the functionality of CGI.pm's compatibility mode.

... with all the added overhead of the CGI.pm module loaded every time
someone invokes your cgi program, and with this overhead providing
absolutely *zip* in the way of functionality if you're only using the
cgi-lib compatibility mode.

CGI.pm is a very useful module, and I heartily recommend it for many
applications.  However, I see no reason why everyone should always
replace each and every use of cgi-lib.pl with CGI.pm.  There are many
cases where cgi-lib.pl works just fine.


ain't broke, don't fix it.

--

 perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;




Mon, 26 Mar 2001 03:00:00 GMT  
 cgi-lib.pl vs CGI.pm?
Is it not true that there is a CGI.pm replacement specifically for
mod_perl with Apache?  And no cgi-lib.pl replacement?  Or do I just not
know about it?  If the above is true, that would be a really good reason
for some folks to use CGI.pm...
Quote:

> Hey folks,

> I've been seeing an overwhelming amount of referance to CGI.pm in CLPM lately,
> and have been wondering if there would be a major shift in value added in me
> switching to it (aside from the obvious benefit of understanding more of the
> articles in CLPM :).

> Currently, I've been using cgi-lib.pl by Steven E. Brenner, which handles a lot
> of the mundane tasks of CGI quite nicely. Are there any overwhelming reasons to
> switch to CGI.pm? I went as far as to print out the docs on CGI.pm (or the
> source, I can't remember which), but for whatever reason put it on the back
> burner and kept on trundling along with cgi-lib.pl.

> Comments appreciated!

> --
> Marc Bissonnette
> InternAlysis
> Corporate Internet Research and Results!
> http://www.internalysis.com



Sat, 07 Apr 2001 03:00:00 GMT  
 cgi-lib.pl vs CGI.pm?
If your programs are not broke, don't fix them.

CGI.pm works great (thanks Lincoln!), but cgi-lib.pl also does a good
job.  cgi-lib doesn't have as many bells-and-whistles as CGI.pm, but it
still gets the basic job done.

Bottom line, if you don't have any reason to switch, don't.

You may, however, want to start writing your _new_ programs using
CGI.pm.  That way, you'll start getting used to it.  Once you get used
to it, you will never switch back!  I know I won't...

HTH,
Brent
--

           Brent Michalski            
        -- Perl Evangelist --          

Resume: http://www.inlink.com/~perlguy



Sun, 08 Apr 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. cgi-lib.pl vs CGI.pm

2. cgi.pm .vs. cgi-lib.pl

3. CGI.pm/cgi-lib.pl benchmark (Was: cgi-lib.pl or CGI.pm?)

4. Whats better cgi-lib.pl or cgi.pm?

5. Whats better cgi-lib.pl or cgi.pm?

6. CGI.pm or CGI-LIB.pl

7. novice question re CGI.pm/cgi-lib.pl

8. cgi-lib.pl or CGI.pm?

9. Problems with http file upload using cgi.pm and cgi-lib.pl

10. Whats better cgi-lib.pl or cgi.pm?

11. ns-upload, CGI.pm & cgi-lib.pl

12. cgi-lib vs. CGI

 

 
Powered by phpBB® Forum Software