Whats better cgi-lib.pl or cgi.pm? 
Author Message
 Whats better cgi-lib.pl or cgi.pm?

Im starting to learn to use perl for pro{*filter*} programs and cgi files
witch of the above librarys are better for writing cgi's? Also if anyone
could recomend a good perl book I would be greatful.
Chad Simmons
P.s. Please send me a reply and post any replys to the newsgroup also.



Fri, 20 Nov 1998 03:00:00 GMT  
 Whats better cgi-lib.pl or cgi.pm?

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc,

:Im starting to learn to use perl for pro{*filter*} programs and cgi files
:witch of the above librarys are better for writing cgi's? Also if anyone
:could recomend a good perl book I would be greatful.

I suggest CGI.pm if you possibly can.  Get it from

    http://www.*-*-*.com/

The complete docs for CGI.pm can be found at

    http://www.*-*-*.com/

Go read them to see the kind of things that CGI.pm will do for you.
Its forte is dynamic forms, but it can do a lot of other things, too.

The cgi-lib.pl library is for very old perls.  While it is much smaller
than CGI.pm, which is certainly a feature, but it does have some
problems you should be aware of.  Since you've asked, you might see
this document:

    http://www.*-*-*.com/ !cgi-lib.html

--tom

--

"Premature optimisation is the root of all evil."
    --Knuth



Sat, 21 Nov 1998 03:00:00 GMT  
 Whats better cgi-lib.pl or cgi.pm?

Quote:

>The cgi-lib.pl library is for very old perls.  While it is much smaller
>than CGI.pm, which is certainly a feature, but it does have some
>problems you should be aware of.  Since you've asked, you might see
>this document:
>    http://mox.perl.com/perl/info/www/!cgi-lib.html

This above-mentioned document is a good summary of some of the
failings of very old versions of cgi-lib (e.g., older than the version
of Perl required to run CGI.pm).  It also has a few minor
misunderstandings by Tom (e.g., cgi-lib supported references before
they even existed in Perl).  Thanks to Tom's detailed review of
cgi-lib.pl, several minor improvements have been made.  cgi-lib now
suffers from almost none of the issues mentioned on that document.
(I wish all my code would be reviewed in so much detail!)

Currently, the main difference between cgi-lib.pl and CGI.pm is that
CGI.pm has many more features.  Most of the features aren't necessary
for most people, and the added complexity makes CGI.pm harder to learn
also means that CGI.pm is slower.

However, Lincoln Stein (author of CGI.pm) has done an fantastic job of
resolving both of these problems with CGI.pm.  The latest versions of
CGI.pm aren't too much harder to learn than cgi-lib.pl and also run
quite quickly for the amount of functionality they contain.  CGI.pm
has a daunting amount of wonderful documentation; by contrast cgi-lib,
since cgi-lib is so intuitive, most people have been able to use it by
just looking at the few examples given for it.  Lincoln has also added
a cgi-lib compatibility mode to CGI.pm, so migration from cgi-lib to
CGI.pm is painless.

My suggestion for most people is to get started with cgi-lib.pl; it's
really easy to learn and lots of books talk about it.  If cgi-lib does
everything you want, stick with it.  If you want to do more (build
complex multi-page forms, maintain state, etc.), then you should
consider migrating to CGI.pm.  If you know in advance that you want to
do complex things and you're already familiar with Perl and the Net
(and you're not ultra-concerned about speed), then jump right in with
CGI.pm first.

Good luck with whichever library you choose.

Cheers,

Steve Brenner

p.s. As noted by Tom, cgi-lib.pl will work on any Perl from versions
around 4.019 through the most modern release, 5.002.  CGI.pm will
require the most modern release of Perl to operate.  So, if you're
stuck with an old perl and can't upgrade, then you will need to use
cgi-lib.pl.  However, if at all possible, you should use modern
versions of Perl to help ensure that your programs are safe and
correct.
--

MRC Laboratory of Molecular Biology  |
Hills Road                           | Office:   +44 1223 248011
Cambridge CB2 2QH, UK                | Fax:      +44 1223 213556



Sat, 21 Nov 1998 03:00:00 GMT  
 Whats better cgi-lib.pl or cgi.pm?

Quote:

>Im starting to learn to use perl for pro{*filter*} programs and cgi files
>witch of the above librarys are better for writing cgi's? Also if anyone
>could recomend a good perl book I would be greatful.
>Chad Simmons
>P.s. Please send me a reply and post any replys to the newsgroup also.

Buy the Camel and the Llama book by O'reilly; beyond all else, they
are fun to read.

I also suggest you start right away at programming.  I have already
written some programs (that I don't dare frighten anyone with by
exposing the code) and yet I am always learning something new.

I often search for scripts and learn from what others have done.

Here is my latest work,

http://www.*-*-*.com/

Peter
 --------------------------------------------------------------
Peter J. Schoenster           Exercise Your Brain...

                        WebSites That Work
Where Service is an Attitude-->   http://www.*-*-*.com/



Sun, 22 Nov 1998 03:00:00 GMT  
 Whats better cgi-lib.pl or cgi.pm?

Quote:


> >Im starting to learn to use perl for pro{*filter*} programs and cgi files
> >witch of the above librarys are better for writing cgi's? Also if anyone
> >could recomend a good perl book I would be greatful.
> >Chad Simmons
> >P.s. Please send me a reply and post any replys to the newsgroup also.

> Buy the Camel and the Llama book by O'reilly; beyond all else, they
> are fun to read.

> I also suggest you start right away at programming.  I have already
> written some programs (that I don't dare frighten anyone with by
> exposing the code) and yet I am always learning something new.

> I often search for scripts and learn from what others have done.

> Here is my latest work,

> http://www.*-*-*.com/

> Peter
>  --------------------------------------------------------------
> Peter J. Schoenster           Exercise Your Brain...

>                         WebSites That Work
> Where Service is an Attitude-->   http://www.*-*-*.com/

I'd wait on the Camel book -- O'Reiley is comming out with a book
for Perl 5 in August.  They do however have the best CGI/perl book
I have seen so far.

Steve S.



Sun, 22 Nov 1998 03:00:00 GMT  
 Whats better cgi-lib.pl or cgi.pm?

Quote:



> : Im starting to learn to use perl for pro{*filter*} programs and cgi files
> : witch of the above librarys are better for writing cgi's? Also if anyone
> : could recomend a good perl book I would be greatful.
> : Chad Simmons
> I agree, CGI.pm is better than cgi-lib.pl.  I think it's because CGI.pm was designed with object-oriented programming in mind.

Can you recomend a refrence book with the commands, etc in it.
Chad Simmons
Thank You
P.s. Could you also tell me about a book for general perl programing?


Sun, 22 Nov 1998 03:00:00 GMT  
 Whats better cgi-lib.pl or cgi.pm?


   > Buy the Camel and the Llama book by O'reilly; beyond all else, they
   > are fun to read.

   I'd wait on the Camel book -- O'Reiley is comming out with a book
   for Perl 5 in August.  They do however have the best CGI/perl book
   I have seen so far.

Nah... go ahead, get the Classic Camel.  It'll give you a start until
August.  Besides, Larry appreciates the extra royalties.  ;-)

-spp
--
Stephen P Potter  Pencom Systems Administration  Mobil Global Financial Markets

     Maintainer of <A HREF="http://perl.com/perl/faq/">Perl FAQ List</A>
   "I'm supposed to be their God, and I've broken five of their commandments
   already.  I'd've broken all six, but there aren't any sheep on board."
                -Dave Lister, 3rd technician, Red Dwarf



Tue, 24 Nov 1998 03:00:00 GMT  
 Whats better cgi-lib.pl or cgi.pm?

I haven't read the O'Reilly books, but I've been reading "Teach yourself Perl
in 21 Days" by Till (Sams Publsihing) and it's real easy reading.  I've been
doing C/C++ development for 4 years, so from a C perspective it seems like
smooth reading.  Just don't let the size intimidate you.

Whether it's better or worse than the Llama book, I dunno.

  Mike Barber
  Painted Moose Productions
  http://www.clark.net/pub/moose/pmp/



Wed, 25 Nov 1998 03:00:00 GMT  
 Whats better cgi-lib.pl or cgi.pm?

Mike> I haven't read the O'Reilly books, but I've been reading "Teach
Mike> yourself Perl in 21 Days" by Till (Sams Publsihing) and it's
Mike> real easy reading.  I've been doing C/C++ development for 4
Mike> years, so from a C perspective it seems like smooth reading.
Mike> Just don't let the size intimidate you.

Mike> Whether it's better or worse than the Llama book, I dunno.

I won't argue "better" or "worse"... everyone's entitled to their
opinion.

But Till's book is *riddled* with technical errors... apparently, he
didn't try many of his examples, nor did he have the book reviewed by
*any* Perl expert that *I* know.

I've said it before, and I'll say it again... I make a standing offer
to *review* any book about Perl, even if it's in apparent competition
with my books.  It's much more important to me to have the *right*
information getting out to the community than to worry about a little
bit of market share.

David Till's book is scary.

Here's an example (and his recent "perl 5" update is no better),
right up front, page 21:

        (4) BUG BUSTER: What is wrong with the following program?

                #!/usr/local/bin/perl
                $inputline = <STDIN>;
                print ($inputline)

Hmm.  I don't see anything wrong with it at all.  Let's see what the
answer says:

        4. The third line of the program is missing a semicolon at
        the end of the statement. [...]

Hmmm.  But that last semicolon is optional.  It may be a *style*
problem, but it's certainly *not* a "bug".

I haven't been able to go more than 4 pages from any random starting
point in this book without bumping into stuff like that.

But, some people prefer Till's book because it covers more.  Fine.
Just remember that "more" stuff that's not technically accurate could
be a liability, not an asset.

Just so I can show that I don't consider ORA books as sacred,
untouchable items, here's one *style* issue I have with the examples
in ORA's "CGI Programming on the World Wide Web".  Shishir Gundavaram
*consistently* does this:

        print "<HTML>","\n";

Uh, uh, uhm, Mr. Gundavaram, *why* is the "\n" in a separate string?

Drives me nuts reading the examples. :-)

At least his examples have been tested, however.  Other than style
issues, I haven't seen any fundamental problems with his code.
Perhaps Shishir is a programmer on a regular basis, and David isn't.
Dunno.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $18,720.69 collected, $172,159.85 spent; just 814 more days

--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying

Web: <A HREF="http://www.teleport.com/~merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me



Wed, 25 Nov 1998 03:00:00 GMT  
 Whats better cgi-lib.pl or cgi.pm?

Quote:


>Mike> I haven't read the O'Reilly books, but I've been reading "Teach
>Mike> yourself Perl in 21 Days" by Till (Sams Publsihing) and it's
>Mike> real easy reading.  I've been doing C/C++ development for 4
>Mike> years, so from a C perspective it seems like smooth reading.
>Mike> Just don't let the size intimidate you.

>Mike> Whether it's better or worse than the Llama book, I dunno.

>I won't argue "better" or "worse"... everyone's entitled to their
>opinion.

>But Till's book is *riddled* with technical errors... apparently, he
>didn't try many of his examples, nor did he have the book reviewed by
>*any* Perl expert that *I* know.

I can tell you what my experience has been with the book.  I am currently
working on a project for a search engine on the net.  I needed some
information on file locking.  I have both the Camel book and the 21 day book.  
The Camel book had an example of locking, but did not describe what happened
if the file was locked.  (It appeared that it went into vapor, but there was
no information either way...)  The Teach yourself Perl in 21 ulcers book only
has a section saying "look at the man pages".  I have found far too many areas
in the Perl in 21 days that has references to man pages instead of taking the
time to explain the simple concept behind the function. The manual pages were
not much help in this either. (BTW, I finally found the answer to how locking
works.  It was in the July Issue of Web Techniques in a column by some guy
named "Randal Schwartz".  Maybe it should be included in the next copy of the
Camel book, if the author can get ahold of him. ]:>)

Starting out the Till books seemed like a good one.  The more I worked with
it, the less I liked what I was finding.  I am just glad I did not buy his
version of the Perl 5 books before I came to this conclusion.  (I am also glad
that I did not pay full retail for the book.  I got it for less than half
price used at Powell's Tech.)

Hopefully the Camel book for Perl 5 will be out soon.  There needs to be more
(good) Perl 5 books on the market.

---
|Coors - For people who don't want to think about what they are drinking.|
|"The m{*filter*}PGP Diffie taught Zimmermann unites all| Disclaimer:         |
| mankind free in one-key-steganography-privacy!"  | Ignore the man      |




Thu, 26 Nov 1998 03:00:00 GMT  
 Whats better cgi-lib.pl or cgi.pm?


Quote:

>Mike> I haven't read the O'Reilly books, but I've been reading "Teach
>Mike> yourself Perl in 21 Days" by Till (Sams Publsihing) and it's
>Mike> real easy reading.  I've been doing C/C++ development for 4
>Mike> years, so from a C perspective it seems like smooth reading.
>Mike> Just don't let the size intimidate you.

>Mike> Whether it's better or worse than the Llama book, I dunno.

>I won't argue "better" or "worse"... everyone's entitled to their
>opinion.

>But Till's book is *riddled* with technical errors... apparently, he
>didn't try many of his examples, nor did he have the book reviewed by
>*any* Perl expert that *I* know.

Well, as for books with errors, the CGI application with Perl
published by Wiley, by John Deep and Peter Holfelder (although
there are many contributions from others) is in a shocking state.

The main complaint I have is about the chapters written by Matt
Wright, whose style and skill is not what I call up to the
standard that should be put into books.

Let alone the editing and quality control. It seems that the authors
asked a whole lot of people to write chapters, they put them
together and then sent it off to Wiley ...

Quote:
>David Till's book is scary.

It seesm so ...

--
Mary had a little spam,
Its text was white as snow.
And everywhere that spam was sent,
the flames were sure to follow.



Sat, 28 Nov 1998 03:00:00 GMT  
 Whats better cgi-lib.pl or cgi.pm?



Quote:
>But Till's book is *riddled* with technical errors... apparently, he
>didn't try many of his examples, nor did he have the book reviewed by
>*any* Perl expert that *I* know.

All the examples labelled "Listing", and all of the sample programs
with answers in the back, were tested both by me and by a technical reviewer.
(The examples in the Perl 5 book have now been tested by two different
technical reviewers, as most of the Perl 5 examples appeared in the earlier
book.)

The BUG BUSTERS weren't as closely scrutinized, since most of the errors
are fairly straightforward.  As you point out below, it looks like I
missed one.

Quote:
>Here's an example (and his recent "perl 5" update is no better),
>right up front, page 21:

>    (4) BUG BUSTER: What is wrong with the following program?

>            #!/usr/local/bin/perl
>            $inputline = <STDIN>;
>            print ($inputline)

*blush* Too much C programming, I guess.  I'll fix this in the next
printing (the first printing of the Perl 5 book is in author correction
right now, which means I can fix stuff before the second printing).

Quote:
>But, some people prefer Till's book because it covers more.  Fine.
>Just remember that "more" stuff that's not technically accurate could
>be a liability, not an asset.

It covers material more slowly, which I believe is of use to people
without large amounts of programming background.  (The O'Reilly Perl
books assume C experience, and the Programming Perl book uses terms
such as "lvalues" that only people with extensive C or compiler
experience really understand.  I myself have spent years learning
programming languages and writing compilers for them, and yet I still
found Programming Perl tough going at times.)

BTW:  I appreciate Randal's offer to review any Perl book, and would
be most grateful if he reviewed mine.  (I have communicated this wish
to him in private e-mail.)  Heck, I'll gladly donate to his legal fund
if he does so.

If anyone else out there reading this finds any problems with my book,
please take the time to let me know.  I hope to make the book as technically
accurate as I can.
--
--Dave Till, Writer and Treekiller, KL Group Inc., Toronto, Ontario, Canada.
My postings are my own opinions, not my employers', but you knew that already.

WWW:  http://www.interlog.com/~davet/ *includes travel diary and book plug!*



Sat, 28 Nov 1998 03:00:00 GMT  
 Whats better cgi-lib.pl or cgi.pm?

=o= To answer the question in the subject line:  it depends
on what you want to do.  If your CGI needs are modest, and if
you're dealing with a lame site where you can't guarantee that
Perl 5 is available, cgi-lib.pl is very useful.  It's nice and
small, and provides much of what you'll need.

=o= The cgi.pm module is more powerful, and far more useful if
you're doing something gnarly.

=o= For Perl/CGI books, I think both O'Reilly and Sams have good
books.  The O'Reilly book covered more of what I'm interested in
doing with CGI.  The Sams book is a good intro to cgi-lib.pl.

=o= There is a dearth of information about Perl 5 in general,
and about Perl 5 features in CGI in particular.  I've picked up
what I know about Perl 5 from http://www.perl.com/.

Quote:
> I haven't read the O'Reilly books, but I've been reading
> "Teach yourself Perl in 21 Days" by Till (Sams Publsihing)
> and it's real easy reading.

=o= I agree it's easy reading, and its slower pace may be better
for beginners.  But there are so many typos and errors!  I think
I'd be thrown for a loop if I *was* a beginner.

=o= I did fine with the Camel book, but I already had experience
with languages that Perl evolved from.

Quote:
> Just don't let the size intimidate you.

=o= I get the feeling that Sams is one of several publishers
who've discovered a market niche:  a big thick book with some
media to go with it.  They're also selling pretty much the
same package as software: a shrinkwrapped box of software
with the Sams book inside, serving as the manual. :-)
    <_Jym_>


Sat, 28 Nov 1998 03:00:00 GMT  
 Whats better cgi-lib.pl or cgi.pm?



: >But Till's book is *riddled* with technical errors... apparently, he
: >didn't try many of his examples, nor did he have the book reviewed by
: >*any* Perl expert that *I* know.

: All the examples labelled "Listing", and all of the sample programs
: with answers in the back, were tested both by me and by a technical reviewer.
: (The examples in the Perl 5 book have now been tested by two different
: technical reviewers, as most of the Perl 5 examples appeared in the earlier
: book.)

: The BUG BUSTERS weren't as closely scrutinized, since most of the errors
: are fairly straightforward.  As you point out below, it looks like I
: missed one.

Quote:
>SNIP<

I have zero knowledge of perl, and I'm hoping to learn it. I have both Learning Perl in
21 Days and Using CGI by Dwight and Erwin, since I want to learn perl for cgi
programming. I find that they play off each other extremely well. Till's book gives
greater depth and breadth, but that was intimidating to me as a rank beginner, because
I couldn't really get a sense of perl and what to do with it. I had the pieces of a
puzzle, but I couldn't put them together. (This is my limitation, not Till's book.) Using
CGI gives the uses, but it is limited to the uses for cgi programming. By reading the
books together, I got more out of both of them, including more ideas than just cgi
programming. The pieces are coming together with a bigger picture than from either book
alone.

As for errors, I have no way of knowing. I'm just slogging through.

My experience in learning other things has been that, for me at least, no one book can
be the one and only answer to all my questions. I find two or three that cover the
topic, and their authors all have different approaches to the topic and different
concepts of learning. If I don't have a teacher to help me with the stuff I don't
understand in one book, at least I have the different approach of another author --
that often solves my difficulty.

Dave, nice response. Always nice to see criticism answered thoughtfully and with good
grace. And it's nice not to be reading about Randal in the papers nowadays. Hope all is
well for him.

Thank you all for your works on perl.

Phil



Sat, 05 Dec 1998 03:00:00 GMT  
 
 [ 14 post ] 

 Relevant Pages 

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

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

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

4. CGI.pm or CGI-LIB.pl

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

6. cgi-lib.pl vs CGI.pm?

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

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

9. cgi-lib.pl vs CGI.pm

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

11. cgi.pm .vs. cgi-lib.pl

12. Problems with Enterprise with cgi-lib.pl/fup.html/fup.cgi

 

 
Powered by phpBB® Forum Software