• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

How CGI Works

A CGI script is a program, and most CGI programs are straightforward and written in C or Perl, two popular programming languages. Listing 28.1 shows a standard "Hello World" example in C.

Note

CGI programs are often called scripts because the first CGI programs were written using UNIX shell scripts (bash or sh) and Perl. Perl is an interpreted language, somewhat like a DOS batch file but much more powerful. When you execute a Perl program, the Perl instructions are interpreted and immediately compiled into machine instructions. Some other languages, such as C, are compiled ahead of time, and the resulting executable isn't normally called a script. Compiled programs usually run faster but are harder to modify.

In the CGI world, however, interpreted and compiled programs are both called scripts.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint