|
INVOKING PL AS A CGI PROGRAMAs of version 2.00, pl may be invoked directly as a CGI program, to dynamically create plots without having to write images to temp files. CGI mode is not available for pltab . CGI mode can produce pseudo-GIF, PNG, JPEG, SVG or SVGZ .To set this up, copy your pl executable to your cgi-bin (or make a link), and create a ploticus config file (see below). The specifics of local CGI bin and file naming conventions vary; see your local admin if having difficulty. Then, use a construct such as this in your HTML page:
This is equivalent to command line usage:
cgi=1 should be the first parameter in your URL construct, as shown in the above example.
After that, the regular
pl command line options and arguments
, including those for
prefabs
,
may be given in the usual order. However, to
conform to URL syntax, a question mark (?) must separate the program name
from the first argument, and ampersand (&) must be used to separate subsequent
arguments. Also, arguments should not be enclosed in quotes. Use %20 to represent
an embedded space, %26 for an embedded ampersand, etc (%XX may be used to represent
any problematic character, where XX is its hex ascii value). Arguments are limited
to a length of 250 chars each and may not contain embedded newlines.
CGI MODE BEHAVIORpl automatically goes into CGI mode if it detects the environment variable REQUEST_URI (set by your web server), and there are no conventional command line arguments given. pl behaves this way when in CGI mode:
TROUBLESHOOTINGWhen using pl in CGI mode, debugging is difficult because diagnostics cannot be viewed, and the image content is being streamed to standard output. If you are having trouble getting pl to work in CGI mode, try the following: cd to your cgi bin, deploy a new term window, and in the new window manually set the REQUEST_URI and SCRIPT_FILENAME environment variables, eg:
These exact variable names should be used. REQUEST_URI should be the full URL, less the http://hostname prefix. Full pathname should be given in SCRIPT_FILENAME so that pl can locate its config file. If you want your CGI to generate PNG you may need to place plpng into your cgi-bin and execute it instead of pl (this depends on your ploticus build). Then, in the new window, invoke pl by hand, with no command line arguments:
Any error messages should be visible on screen.
In theory CGI mode should work with PNG, GIF, JPEG and SVG.
I noticed some flakiness with SVG. If the pl script argument was
last and I was generating SVG, MSIE wouldn't display it until I added a trailing &
to the URL. And, MSIE didn't understand SVGZs when generated in CGI mode.
CGI SECURITYYou should be fully familiar with CGI security issues and how they relate to your platform and project, before putting pl into service as a CGI program. Some thoughts:
|
![]() data display engine Copyright Steve Grubb ![]() |