CGI Programming Unleashed

By Eugene Eric Kim
The first things you should know about Common Gateway Interface (CGI) are what it is and why it is used. CGI is a standard whose specification defines a way for Web servers to communicate with external programs, and vice versa, so that the external program can generate HTML, images, or whatever, and have the server treat it the same as HTML, images, and so on not generated by an external program. The reason CGI is used is so you can generate dynamic content with the same ease that you generate static content. CGI is used because it is a very well defined and supported standard, and without CGI, dynamic content would have been impossible without proprietary server methods (now, there are alternatives to CGI that are becoming standard).
There are many useful applications of CGI programs. But, as with every other technology, CGI programs have their limits. Also, as with many other technologies, it is not always the best way to do things. For this reason, this chapter will go over what CGI programs can and cannot do, and what CGI based apps are good and bad for.
For comparison's sake, I use Java as the applet language.
What CGI Is Useful For
As stated earlier, CGI is useful for many different tasks. There are different reasons why it is the best method, or the only method, for a variety of tasks. This chapter examines the reasons, separating the tasks into three different levels. First, we cover simple tasks, which we will define as tasks that can be completed in a couple of hours and/or require almost no knowledge of how to program CGI apps/the CGI spec in general. This task level includes counters, among other things. Next, we cover intermediate tasks, which we will define as tasks that can be completed in a day or two and/or tasks that require a pretty good knowledge of how to program CGI apps/the CGI spec in general. This task level includes built from scratch imagemapping programs, apps that generate entire HTML pages, and apps that do animation, among other things. Finally, we cover advanced tasks, which we will define as tasks that take more than a day or two and/or require an expertise in CGI app programming/the CGI spec in general. This task level includes apps that include a home grown database engine, among other things.

Followers