HP e3000 Web Server CGI Programming (November 2008)
Figure 4. Webbified VPLUS application
CGI programming on the HP e3000
The rest of this paper will demonstrate CGI programming in some popular languages on the HP
3000. CGI was first developed on UNIX derivatives, and since MPE/iX supports POSIX, it is quite
easy to write CGI programs on the HP 3000. The same example has been provided in C, PASCAL
and PERL to demonstrate the differences in using these languages.
The application is a simple phone book which can store names and numbers. Once completed, this
application can be used to add, delete and search for names and phone numbers. This application
was intentionally kept small and simple for
the sake of discussion. The emphasis here is to
demonstrate what is required to write a CGI program and not the function of the program.
The general steps involved in the application are as follows:
1. Read input from STDIN (this input originated from the browser via the magic of CGI)
2. Parse the input string to separate out the individual fields
3. Perform the required operation (In this case ADD/DELETE/SEARCH)
4. Print the MIME header indicating the type of data that is to follow (this goes directly to the web
browser via the magic of CGI).
5. Print the output that is to be displayed by the browser. The format of this output has to
correspond to the MIME type specified in the MIME header in step 4 (this output also goes to
the web browser by the magic of CGI)
6. Exit
To get a working CGI program two components are required:
1. HTML form which will receive input for the CGI program, and,
2. The CGI program itself.
The same HTML form will be the user interface to the phonebook applications in the different
languages. Following is the HTML source of the form which will be used.
Page
4
of
10
HP e3000 Web Server CGI Programming
11/13/2008
http://www.hp.com/cgi
-
bin/pf
-
new.cgi?IN=http://jazz.external.hp.com/papers/cgi
-
paper/c
...