hyrum has asked for the wisdom of the Perl Monks concerning the following question:

I have read many tutorials and am still using cgi-lib and not cgi.pm since I have not been able to find a good tutorial. I am also about to start working with mySQL. I am wondering if anyone here that knows a few things about perl would be interested in writing a few tutorials. I have a site technetcentral.com which is going to be used for lessons, tutorials and the like and would be very interested in having someone share their knowledge :)

Replies are listed 'Best First'.
Re: Tutorials
by merlyn (Sage) on Aug 25, 2000 at 21:37 UTC
    There are dozens of examples of using CGI.pm on the net. Some of them have even made it into my columns. {grin}

    What exactly are you looking for that you haven't found already?

    -- Randal L. Schwartz, Perl hacker

(jeffa) Re: Tutorials
by jeffa (Bishop) on Aug 26, 2000 at 02:58 UTC
    If you are also looking for cool snippets of CGI.pm in action, check out Randal Schwartz's WebTechniques listings. I like to think of them as the excerises that should come along with a tutorial.

    Some of them are old - but not necessarily outdated. They serve as milestones in the evolution of dynamic web pages.

      Thank you very much for that. Yes, there are certainly more than a few that I would rewrite today given what else is now available, or what I now know. But with 2000 hits per day in that zone alone, I must be hitting the motherlode of ideas pretty close to dead center.

      -- Randal L. Schwartz, Perl hacker

Re: Tutorials
by hyrum (Initiate) on Aug 25, 2000 at 21:43 UTC
    I want something that starts from the basics. I learned perl using cgi-lib and so want to know everything about cgi.pm that I can. I'm also looking for someone that would be interested in writing a tutorial on it.
      Have you looked at the docs that come with CGI.pm? They actually have quite a few examples. If that's not enough, Lincoln also has an expanded book on that.

      -- Randal L. Schwartz, Perl hacker

        I too started from cgi-lib, and I've always found CGI.pm's docs insufficient as a tutorial...they assume you have been using CGI.pm through it's evolution. The docs use terminology that may not be familiar to the reader. And if the original poster is like me, and doesn't wish to mix content with code, none of the HTML functions are desired.

        Original poster, my humble advice is:

        • Start by using:
          use CGI; $page = new CGI; CGI::ReadParse(); print $page->header; #Rest of stuff here
          in place of cgi-lib, &ReadParse, and &PrintHeader. The rest of the script will be the same. Immediate advantage is to be able to test your scripts off-line.
        • Next, learn the secrets of the CGI->new() syntax, and learn about how you can save state.
        • Also learn the param() and import_names() calls. Then you can get rid of ReadParse();
        • Only use the HTML functions if you want to. If you have some other methods of outputting HTML content, they can be just fine.
        • As always, use -w, use strict, and -T.
        • the header() function has many useful options, and redirect() is very nice too.