|
Writing CGI Applications with Perl - Foreword
Foreword - Lincoln Stein
When the Web exploded in popularity in the mid-90's, sweeping away
Gopher, WAIS, Hyper-G and other competing technologies, a big part of
its phenomenal success was the ease with which developers could attach
backend processing to pretty front-end Web pages. Rather than
offering an arcane programmer's interface to a limited number of
programming languages, the Web offered the Common Gateway Interface,
or CGI.
CGI is the vice grip of the Internet. It is language-independent,
platform-neutral, and best of all, easy to learn. You can write a CGI
script to generate a dynamic Web page in just a couple of lines of
code, and with not much more work you can accept user input from a
fill-out form, pass it to a backend program or database for
processing, and generate a new Web page to show the results. CGI
allows you to take any new or legacy application and wrench it into a
form that can be served over the Web.
Almost from the start CGI was associated with the Perl programming
language. In fact, to many people CGI is synonymous with Perl and
vice versa. There are good reasons for this. If CGI is the vice grip
of the Internet, then Perl is its duct tape. Perl's interprocess
communications abilities couple with its powerful text parsing
facilities to create an environment that makes it easy to combine
unrelated software components into a seamless whole.
For example, a typical e-commerce site needs to interface to a search
engine, display catalog pages using up-to-date price information
contained in a database, manage a shopping cart, and handle order
entry, credit card validation, and order fulfillment. Perl excels
that this type of task. It can run the search engine and transform
its output into a hyperlinked web page, generate on-the-fly catalog
pages from information contained in the stock database, transmit
credit card information across the network to a verification service,
and enter the user's order into the fulfillment database.
The range of innovative applications that people have built on top of
Perl/CGI is nothing short of amazing. Tourism agencies use Perl/CGI
to generate interactive maps of cities and towns. Medical schools use
Perl/CGI to run interactive simulations of human physiology. The
human genome project uses Perl/CGI to share its vast holdings of
mapping and sequencing data with the biological research community.
Perl/CGI has also been used to glue a vast array of hardware devices
to the Web -- everything from fish-cams to robotic arms.
The Web has gotten a lot more complicated over the years. It's no
longer sufficient just to accept user input from a fill-out form and
generate an HTML pages in response. Web sites must be prepared to
parse XML, generate XHTML and DHTML, manipulate cookies, and interact
with increasingly distributed back-end systems. Users also have
heightened expectations for the Web site experience. Users expect Web
sites to remember them from visit to visit, and to allow them to
customize the site to meet their particular needs.
Thankfully, as the Web has evolved, Perl and CGI have grown to meet
the challenges. This book demonstrates just how potent and vital the
combination of Perl and CGI remains. In these pages you will learn
how to glue Web pages to databases, track uers' click trails, exchange
information with other sites using XML, and generate graphics and
animations on the fly. Just as importantly, this book focuses from
the outself on three issues that are often ignored in the pell-mell
pace of Web development: security, reliability and scalability.
I know that you'll find the combination of Perl and CGI to be both
powerful and enjoyable, as I have over many years.
Lincoln Stein
Stonybrook, NY
December 8, 2000
|