|
Par ce dispositif a également d'autres instructions :
Facilité d'utilisation
HP e3000 Web Server CGI Programming
Page 9 of 10
Copy phonebook.pas to the cgi-bin directory and set the appropriate permissions and ownership
(refer to the C example subsection).Also make sure that the cgi-bin directory is writable by the web
user since the phonebook application needs to create a flat file in that directory. Now create the
HTML form that has been provided at the beginning of this section. Modify the URL in the ACTION
argument of the FORM tag to point to your pascal phonebook application (http://
bin/phonebook.pas) replacing
hard disk or on the webserver. Once you load the form into your web browser you should be able to
use the Pascal Phonebook application.
Phonebook application in Perl
PERL is the most popular language for writing CGI programs. The reason for this is due to PERL's
plethora of simple but powerful string manipulation and parsing capabilities. This capability saves
having to write the CGI parsing routines which were required in the previous examples.
Perl (version 5) can be downloaded for free from < http://www.bixby.org/mark/perlix.html >
The Perl implementation of the Phonebook application is similar to the C version except that it is
much shorter. The main reason is due to built in functions in Perl which do away with the need for
having separate CGI input parsing routines.
The important portion of the Perl code is the main program which does not come under any
subroutine heading (the first 50 or so lines). This portion of code does the CGI parsing and calls
appropriate subroutines depending on the ACTION. The subroutines print the output for the action.
Note the first line of the program ( #!/usr/local/bin/perl ). This needs to point to the location of the perl
interpreter on your system. If Perl resides elsewhere on your system then modify this line to point to
the right place.
Compiling and activating the phonebook
Perl programs are interpreted so there is no separate compilation step to prepare this application.
To install the program, save it as phonebook.perl and copy it to the cgi-bin/ directory on your
webserver. Make sure that the permissions have been set correctly so that it is executable by the
web user (refer to the Phonebook Application in C example subsection). Also make sure that the cgi-
bin directory is writeable by the web user since the phonebook application needs to create a flat file in
that directory. Now just create the HTML form that has been provided at the beginning of this section.
Modify the URL in the ACTION argument of the FORM tag to point to your perl program
(http://
Save this on your PC's hard disk or on the webserver. Once you load the form into your web browser
you should be able to use the Perl Phonebook application.
COBOL CGI program
We have contracted with an HP 3000 Electronic Commerce Integrator to provide a CGI programming
example with Cobol. When this sample application becomes available it will be placed on the Jazz
server (http://jazz.external.hp.com) in the Sources and Binaries directory.
Guidelines for writing CGI programs
CGI programs should be light-weight. i.e. they should not be large and complex. The larger they are
the heavier the load is on your webserver. The reason is that for each CGI request (user clicking on a
button to perform some action) from the browser a copy of the CGI application has to be loaded,
executed and destroyed. This can easily degrade the performance of a system with just a nominal
CGI request load IF the CGI applications are large. Another fact to keep in mind is that the probability
of bugs in your CGI program is proportional to its size and complexity. Bugs in CGI programs can
cause security problems, especially if these bugs can be utilized to do devious things. Again, make
sure that your web user (usually USER.WWW) does not have any special capability, like PM. Also
make sure that all the CGI programs are owned by this user. If you need your CGI programs to have
a lot of functionality and perform complex tasks then it is better to isolate this functionality into a
http://www.hp.com/cgi-bin/pf-new.cgi?IN=http://jazz.external.hp.com/papers/cgi-paper/cg... 7/18/2008
...
Logiciel - MPE/iX 6.5 Operating System (355.95 kb)
Logiciel - MPE/iX 7.0 Operating System (355.95 kb)
Logiciel - MPE/iX 7.5 Operating System (355.95 kb)