[NBLUG/talk] CGI programming memory lapse

Troy Arnold troy at zenux.net
Mon Jun 5 12:45:13 PDT 2006

On Mon, Jun 05, 2006 at 12:33:23PM -0700, Lincoln Peters wrote:
> About five years ago, I knew how to write CGI web applications using 
> Perl.  Last week, I found reason to write another such application.  
> Unfortunately, five years of inactivity* can lead to a surprising loss 
> of skill!
> Specifically, while I'm having little difficulty getting Perl scripts to 
> compile and run, or getting MySQL to behave the way I expect, I cannot 
> seem to remember how to make Perl scripts read the data submitted to 
> them via HTML forms (as per the <form> tag).  And I no longer seem to 
> have a copy of _CGI Programming with Perl_!

That book sucks eggs.  It's awful, awful, awful.  And now it's old, old,

> Since it will take me at least a few days to replace my copy of the 
> book, and I can't seem to make any sense of the pages I get when I 
> search Google for "Perl CGI" (without quotation marks), would someone 
> mind refreshing my memory as to how to read input from an HTML form?

The easiest way is:

use CGI;

$q = new CGI;
print $q->header;
print $q->param('foo');

see: http://search.cpan.org/dist/CGI.pm/CGI.pm

More information about the talk mailing list