cgi banner gif

home ch01 ch02 ch03 ch04 ch05 ch06 ch07 ch08 ch09 quick reference


Introduction

Over the past few years, the Internet has emerged from relative obscurity and become a household name. Most of this growth can be attributed to the World Wide Web, which is just one area of the Internet. Before the Web evolved, the Internet was primarily a text-based environment, not known for being particularly accessible. Most people were not interested by this type of text-based setting--many even found it intimidating. What the World Wide Web offered, which the rest of the services on the Internet had not, was a rich multimedia experience. Web pages could incorporate images, sounds, and video, giving Web sites vast audience appeal. The World Wide Web transformed the Internet from a tool for experts and specialists into a user-friendly, exciting, and entertaining environment in which you could get work done or have fun, all with a few mouse clicks or keystrokes.

You are probably already somewhat familiar with the World Wide Web. You most likely have even heard of CGI scripts and are looking for information about how to write your own. But what made you pick up this book? Did you choose it because it's smaller than the others on the shelf? Did you think it would be concise and would present you with exactly the information you need to get started? If so, you won't be disappointed. This book is a brief but thorough introduction to CGI scripting. It can be both simply because you do not need to learn a lot to write CGI scripts.

This book is organized so you can quickly learn what you need to know and get started with your own CGI scripts. It is divided into three parts, each with a specific focus. You don't need to read this book from cover to cover to start writing your own CGI scripts. You only need to read the sections that supply the information you need or that include examples of interest to you.

The first part, which contains three chapters, is an introduction to the nuts and bolts of CGI scripting. The first chapter presents an overview of the Internet, the World Wide Web, HTML, and CGI. It introduces concepts that are important to CGI, such as URLs, HTTP, and the division between client and server computers. If you already have a good grasp of this material and of what CGI is in general, go ahead and skip to Chapters 2 and 3, which supply you with all of the tools you need to begin writing your own scripts. Chapter 2 explains how your script gets data from the Web server and sends output back to the Web browser. Chapter 3 addresses CGI programming issues, such as choosing a programming language, where to place your script files, how to call your scripts from the Web browser, common errors, and security.

The second part of the book includes six chapters that present six practical examples of CGI scripts. These examples reflect some of the most common applications of CGI scripts on the Web. You'll find example form handlers, guest books, shopping carts, access counters, and bulletin boards. There are also some simple examples that demonstrate how to interact with databases and how to animate your Web pages.

At the end of the book is a Quick Reference that lists a number of online resources This section contains a collection of Web URLs, newsgroups, and mailing lists where you can go to for further information on CGI, HTML, HTTP, the World Wide Web, and the Internet. Don't hesitate to explore; that's what using the Web is all about. That's also how you'll find the most up-to-date information available.

Most of the scripts in this book are written in Perl version 5, with one example in C, but no prior knowledge of Perl or C is assumed. The functionality of each code segment is explained thoroughly, allowing you to rewrite the code in your language of choice. However, if your project does not restrict you to a certain language, I highly recommend becoming acquainted with Perl. If you already know any programming language, Perl is easy to learn; it is also very well suited for CGI scripting. If you need help learning Perl, check the resources listed in the Perl section of the Quick Reference at the end of the book.

All of the scripts in this book have been tested on three machines. The first is a DEC Alpha 1000 running the OSF version 3.2 version of UNIX. Because the examples are written in Perl, they contain no machine-specific code and should work equally well under any other UNIX configuration. The DEC Alpha was running Netscape's Communications Server version 1.1 as the Web server. The scripts have also been tested on both a Windows 95 and Windows NT (version 3.51) machine. The Windows 95 machine is a Compaq Deskpro 5120 (120 MHz Pentium machine) with 48MB of RAM. The Windows NT machine is a Gateway 2000 433V (33 MHz 486 machine) with 20MB of RAM. Both Windows machines were using O'Reilly's WebSite version 1.1 as the Web server.

The Internet is in a constant state of flux. Because of this, I highly recommend that you investigate the online resources listed in the Quick Reference for further information after reading this book. I also welcome any comments or questions you may have regarding the content of this book or the Internet in general. You can reach me at robertm@deltanet.com. In the meantime, welcome to CGI scripting!

On to the book...


home ch01 ch02 ch03 ch04 ch05 ch06 ch07 ch08 ch09 quick reference