Installing the CGI interface for SQR
Using cgi-lib.sqh and sqr.pl to execute SQR programs through CGI
requires that you know the path and URL for the following directories.
NOTE: It is possible from some of the above to be the same directories.
- Location of HTML files that the webserver serves.
- Directory where the SQR programs write their output.
It must be writable by the user under which the webserver runs and
within the tree of directories served by the webserver.
- Directory from which the webserver will execute programs.
- Directory where the SQR programs are. This will need to be
readable by the webserver but is probably outside of the tree of
directories served by the webserver (i.e. it does not have a URL).
Parts of the CGI-SQR Interface
There are two parts to the CGI-SQR intraface, a library of SQR procedures
and a wrapper to call SQR with the correct command line and environment.
The library, "cgi-lib.sqh", should be included in the SQR programs that
will be called through CGI. There are two different strategies for the
The first strategy is to have one wrapper script for the whole
server. The wrapper reads information in its URL and calls the
appropriate SQR program. "sqr.pl" is an example of this strategy. The
advantages for the "one wrapper" method are that its is centrally managed
and you do not have to create a wrapper for each SQR.
The second strategy is to have a separate smaller wrapper for each SQR.
This would be a small shell script or batch file that sets some environment
variables and then calls SQR. "example1.sh" and "example2.sh" use this
method. The advantages for the "many wrappers" method are simplier
wrapper programs, simplier URL's, and ease of customizing the command line
of a particular SQR program.
Choosing the right method for your site is something of a judgement call.
For sites with a large number of SQR's that accept the same command line
the "one wrapper" strategy will probably work better. For sites with only
a few SQR programs or where each SQR needs a different command line,
the "many wrapper" mehtod is probably better. These methods are not mutually
exclusive. You could have one large wrapper, but still create a small one
for a peculiar SQR.
Hint: Create an include file for all your Web SQR's that includes the
URL for the static pages and the SQR's. Also include procedures that
show an html header and footer for the returned pages.
- Put your wrapper program in the CGI-BIN directory
Make sure that it is readable and executable by the webserver.
Also make sure that is reflects your configuration (paths, usernames,
- Put "cgi-lib.sqh" along with the SQR programs to be run in the CGI-SQR directory
Be sure that they are all readable by the webserver. Edit the existing SQR programs to include "cgi-lib.sqh" and to use it for input.
- Create links or forms in HTML files in your HTML directory that call your