CGI" stands for "Common
Gateway Interface." CGI is the method by which a web server can obtain data
from (or send data to) databases, documents, and other programs, and present that
data to viewers via the web. More simply, CGI is programming for the web. A CGI
can be written in any programming language, but Perl is the most popular, and
for the course of this book, Perl is the language we'll be using.If you're going
to create web pages, then at some point you'll want to add a counter, a form to
let visitors send you mail or place an order, or something similar. CGI enables
you to do that and much more. From mail-forms and counter programs, to the most
complex database scripts that generate entire websites on-the-fly, CGI programs
deliver a broad spectrum of content on the web today. If you've ever looked at
a site such as Amazon.com, DejaNews, or Yahoo, and wondered how they did it...
the answer is CGI. CGI experience is also in high demand from employers now; you
could substantially improve your salary and job prospects by learning CGI.
A CGI
program is still a Perl script. Perl is a simple language, easy to learn, yet
powerful enough to accomplish the most difficult tasks. It is widely available,
and is probably already installed on your Unix server. Perl is an interpreted
language, meaning you don't need to compile your script - you simply write your
script and run it (or have the web server run it). The script itself is just text
code; the Perl interpreter does all the work. The advantage to this is you can
copy your script with little or no changes to any machine with a Perl interpreter.
The disadvantage is you won't discover any bugs in your script until you run it.
You can edit your Perl scripts either on your local machine (using your favorite
text editor - Notepad, Simpletext, etc.), or in the Unix shell.