1Getting Started with Perl
2Getting Started with CGI
4Flow Control
5Working with Scalars
6Working with Lists
7Working with Hashes
8Reading, Writing and Manipulating Files
9Pattern Matching
10Creating and Using Subroutines
12Packaging and Modules
13Using the CGI.pm Module
14Retrieving Data with CGI
15CGI Script Debugging and Security

CGI Programming with Perl

Lesson 2: Getting Started with CGI

1. The Client (Internet Browser) requests a CGI script.
2. The Server recognizes the Client's request for CGI services.
    2a. www.fatpat.com/cgi-bin/script (cgi directory)
    2b. www.fatpat.com/directory/script.cgi (cgi file extension)
3. The Server stores user information from the Client.
4. The Server redirects the CGI <STDOUT> to itself for verification.
5. The Server passes control to the CGI script.
6. The CGI script outputs HTTP document header information
7. The CGI script outputs HTML code.
8. The Server checks the HTML code for errors and transmits to Client.
9. The CGI script terminates and ends the transaction.


1-4 #!c:\perl\bin\perl.exe
use CGI;

my $cgi = new CGI {name => 'bill', job => 'programmer'};

my $name = $cgi->param('name');
my $job = $cgi->param('job');

print $cgi->header, "Hello World, my name is <B>$name</B>", " and I am a <I>$job</I>.";


fatpat Software · PO Box 1785 · Charlottesville, VA 22902 · (804) 977-1652