Programming Exercise IV Construction (Cont.)

  1. Calling a CGI Script (Unix Shell)
  2. CGI (Common Gateway Interface) is a standard for running external programs from a World Wide Web HTTP server. CGI specifies how to pass arguments to the executing program as part of the HTTP request. It also defines a set of environment variables. Commonly, the program will generate some HTML pages which will be passed back to the browser. For the previous interface, the following CGI script ListRoutes.cgi is activated once a button is clicked:

    ~/public_html/cgi-bin/280/4/ListRoutes.cgi
    #!/usr/bin/bash
    
    CLASSPATH=.:/usr/lib/oracle/12.1/client64
    CLASSPATH=$CLASSPATH:/usr/lib/oracle/12.1/client64/lib/ojdbc7.jar
    CLASSPATH=$CLASSPATH:/usr/lib/oracle/12.1/client64/lib/ottclasses.zip
    export CLASSPATH
    
    /usr/bin/perl  ListRoutes.pl

    These statements are the minimum, but they work so far. We may need to add more statements later if necessary. The last statement calls the CGI Perl script, ListRoutes.pl . Note that

    • “Internal Server Error” will be issued if the Perl script does not include either one of the following two commands:
         print( "Content-type: text/html\n\n"  );
         print( "Content-type: text/plain\n\n" );
    • This script is for setting the environment variables for JDBC. If JDBC is not used in this function, you may skip this step.



      Hear about the new restaurant called Karma?    
      There’s no menu: You get what you deserve.