CGI Scripts

Preparing The Scripts Parsing Emailing




Extra Tips

A couple of caveats before we get started with CGI scripts:

First, these scripts are for Unix servers. If you have a Windows NT server, you'll have to adapt the scripts.

In addition, you'll need your ISP's permission to run CGI scripts. Not all ISPs will let you.

For testing, Windows users can download a personal Web server like Sambar or Xitami, or use the Microsoft Personal Web Server (it came with my Windows 98). Mac users also have a free personal Web server included with their system software.

Second, the scripts included here are totally basic--designed only to let you see a script in action. You can find more scripts on CPAN. In an earlier edition of the book, I included a script that actually parsed the data. In this edition, I simply use the standard CGI.pm to do the work. CGI.pm is a Perl module written by Lincoln Stein. It is included in all standard Perl installations.

Third, setting up a script is not the simplest procedure, and depends a great deal on your ISP and how they've set up the server. See page 268 in my HTML/XHTML book for a rough outline of what you need to do. There's a bit more detail on my Getting a script up and running page that should get you going.

Please remember that this book is about (X)HTML. Creating Perl CGI scripts is a huge topic all by itself, and many books have been written solely about them, including my own: Perl and CGI for the World Wide Web: Visual QuickStart Guide. These scripts are not the be-all and end-all, they're just designed to let you observe how scripts work. There are so many things you can do with scripts, it'd be impossible for me to offer them all (especially in a book about (X)HTML!) Still, I'd like you to be able to play around with forms; that's why the scripts are included.

OK, here are the scripts!