[prog] more CGI programming

Dan Richter daniel.richter at wimba.com
Mon May 26 11:26:18 EST 2003


My "objective" is as follows: I wrote a simple program that extracts 
information from Hotmail, and I'm trying to see if I can convert it into a 
full-blown CGI program to help me report spam. This requires analyzing web 
pages, and Perl is very well adapted to this task. I'm quite versed in PHP 
but I'm only somewhat familiar with Perl.

The word "objective" is in quotes because learning CGI programming in Perl 
is not just the means to an end, but an excellent thing to know in its own 
right.

Experience has taught me that, while I could stumble through it on my own, 
I will invariably end up putting forth a lot of effort to do what someone 
else has already done (ten times better).

I noticed Perl's CGI class:
   http://www.perldoc.com/perl5.8.0/lib/CGI.html

But it is intended as a reference; it's too verbose to serve as an 
introduction.

Elizabeth sent me her demonstration program:
   http://www.soggytrousers.net/repository/upload.pl
It was just what I needed. In particular, it showed how to use the CGI 
class to retrieve POST parameters (and, by extension, GET parameters). It 
also taught me this trick, which I never would have guessed on my own:
    use CGI::Carp qw/fatalsToBrowser/;
It causes error messages to be output to the web browser.

In addition, it showed how to use the CGI class to generate HTML, which 
isn't necessary but is handy.

========== Dan Richter ============== mailto:Dan at wimba.com ===========
   [M]y wife and I attended grad school in linguistics at Berkeley
   and UCLA. At the time, we were actually planning to be
   missionaries (more specifically, Bible translators), but we had
   to drop that idea for health reasons. Funny thing is, now the
   missionaries probably get more good out of Perl than they'd have
   gotten out of me as a missionary. Go figure.
      - Larry Wall (inventor of Perl)



More information about the Programming mailing list