CGI Programming on the World Wide WebBy Shishir Gundavaram
1st Edition March 1996
This book is out of print, but it has been made available online through the O'Reilly Open Books Project.
CGI concepts are not very difficult, but you have to firmly understand a few aspects of how the client and server work before you start programming. So I offer a quick introduction in Chapter 1, The Common Gateway Interface (CGI), followed by a discussion of basic protocols in Chapters Chapter 2, Input to the Common Gateway Interface and Chapter 3, Output from the Common Gateway Interface. After that, it's off on a whirlwind tour of CGI techniques, with complete working examples.
Chapter 1, The Common Gateway Interface (CGI), explains how CGI works and compares the different languages you can use to write scripts.
Chapter 2, Input to the Common Gateway Interface, describes the input from Web client to server, which you need to capture and parse. Query strings and input streams are discussed here.
Chapter 3, Output from the Common Gateway Interface, describes the output that a Web server sends to a client. Everything a CGI programmer needs to know about the HTTP protocol is here, including error values and HTTP headers.
Chapter 4, Forms and CGI, introduces you to HTML forms and to some simple form-based CGI applications.
Chapter 5, Server Side Includes, covers some useful, quick services that the server can handle for you, such as inserting the current date into your document.
Chapter 6, Hypermedia Documents, shows a variety of ways to incorporate graphics and animation into CGI output. Among the languages and extensions illustrated are PostScript, gnuplot, the gd extension to Perl, and the pgperl plotting library.
Chapter 7, Advanced Form Applications, shows more complicated examples using the forms interface to CGI. I show a generalized interface that you can use to let your colleagues develop their own forms (the quiz application I mentioned earlier).
Chapter 8, Multiple Form Interaction, shows several approaches to passing information between multiple CGI programs. I show how to use hidden fields, Netscape's persistent cookies, and CGI side includes to "maintain state."
Chapter 9, Gateways, Databases, and Search/Index Utilities, shows you how to hook up with existing programs to extend the power of your own CGI script. I introduce several ways to use SQL in a CGI program, including interfaces to Oracle, Sybase, and my own Sprite library.
Chapter 10, Gateways to Internet Information Servers, extends the ideas in Chapters 7 through 9 to communication over the Internet. The main example in this chapter is a cookie server that can maintain state information for multiple CGI programs.
Chapter 11, Advanced and Creative CGI Applications, includes several advanced examples, particularly a calendar program that shows you how to generate an imagemap and interpret clicks on the fly.
Chapter 12, Debugging and Testing CGI Applications, lists common errors and shows you how to use my CGI Lint tool.
Appendix A, Perl CGI Programming FAQ, is a Frequently Asked Questions list for Perl CGI.
Appendix B, Summary of Regular Expressions, lists syntax for regular expressions in Perl.
Appendix C, CGI Modules for Perl 5, introduces a variety of CGI modules for Perl 5 and shows some examples of their use.
Appendix D, CGI Lite, introduces the CGI Lite library of Perl 5.
Appendix E, Applications, Modules, Utilities, and Documentation, lists URLs and print resources for CGI documentation and software.
Back to: CGI Programming on the World Wide Web
© 2001, O'Reilly & Associates, Inc.