NCCI Perl Documentation                                    G(3)

 

 

 

NAME

     G.pl - CGI interface routines - simplified cgi-lib.pl

 

SYNOPSIS

         # Access to modules (see the NOTES section for setup)

         BEGIN {

             ...

             push (@INC, "../sys/csbase/lib");

         }

 

         require 'G.pl';

 

         # Read any data from the requesting form and then

         # pick up the parameters for this script (from form

         # data or specified on the URL).

 

         my (%in) = &G::ReadParse;

 

         # Fetch the CGI parameter "FIELD".

 

         my ($fieldValue) = $in{"FIELD"};

 

 

DESCRIPTION

     This Perl5 library implements a perl interface to the HTTP

     Common Gateway Interface (CGI) protocol.

 

     It is similar to the popular cgi-lib.pl, but with some

     simplifications:

 

     - The rarely used and cantankerous Mime/Multipart protocol

     is not supported.

 

     Functions

 

     %in = ReadParse ()

         Reads in GET or POST data, converts it to text (removing

         HTTP %xx escape sequences), and puts one key=value in

         each member of the %in hash.  Duplicate GET or POST

         parameters (typically generated from lists which allow

         multiple selections) have a single entry in the %in hash

         with the individual values separated by '\0'.

 

     XCoordinate ()

 

     YCoordinate ()

         Returns the X and Y coordinates for a hit on a clickable

         image.

 

     MethGet ()

         Return true if this cgi call was using the GET request,

         false otherwise.

 

 

 

12/May/99       Last change: perl 5.004, patch 01               1

 

 

 

 

 

 

NCCI Perl Documentation                                    G(3)

 

 

 

     MethPost ()

         Return true if this cgi call was using the POST request,

         false otherwise.

 

     MyURL ()

         Returns a URL which invoked the CGI script.

 

     CgiError (@msg)

         Prints out an error message which which contains

         appropriate headers, HTML markup, etcetera.

 

         If no parameters are supplied, CgiError displays a

         generic error message.  Otherwise, the first parameter

         will be the title and the rest will be displayed as

         different paragraphs of the body of the generated HTML

         page.

 

     dieCgi (@msg)

         Identical to CgiError(), but also logs the error using

         LogError() and then issues a perl die() with the

         supplied error message.

 

     PrintVariables (%in)

         Nicely formats variable/value pairs in the supplied hash

         and returns the HTML string.

 

     LogHit (%options)

         Logs relevent data for a "web hit" to a log file and to

         a set of DB_HASH files which record web site usage

         metrics in a "standard format".  If problems arise,

         dieCgi() is invoked unless the -noDie option is set to

         nonzero.

 

         Returns undef on success, or an error string on failure

         (if the -noDie option is set to nonzero)

 

         Options:

          -noDie        If set to non-zero, this routine return

                        the text of any error message.

 

          -noMetrics    Only write the hit.log file, not the

                        metrics DB_HASH files.

 

         Example:

          my ($errorText) = LogHit ("-noDie" => 1);

          if ($errorText) { die $errorText; }

 

     LogError ($details)

         Log an error. A standard error file (../log/error.log)

         is augmented with context information, any supplied

         details, and all the environment variables supplied to

         the CGI.

 

 

 

12/May/99       Last change: perl 5.004, patch 01               2

 

 

 

 

 

 

NCCI Perl Documentation                                    G(3)

 

 

 

     browserFeatureAvailable ($browser, $feature)

         Given a browser string as per the environment variable

         HTTP_USER_AGENT and a feature:

 

          return 0 for not available

          return 1 for available

          return 2 for don't recognize feature string

 

         Current supported features are:

 

          'MULTIPART-X-MIXED-REPLACE'

          'FRAMES'

 

 

WARNING

     None

 

SEE ALSO

     Encode(3), GBasic(3)

 

NOTES

     This module has not yet been set up for "installation" in

     your local Perl. We currently use a set of conventions for

     access to this module, until the install procedures are

     developed:

 

     - The source code lives on development and production hosts

     in the directory /Volumes/app/cs/csbase/lib.

 

     - By convention, a project maintains perl scripts in

     subdirectories of some top-level directory, which we will

     call $TOP.

 

     - By convention, projects establish a $TOP/sys directory

     which contains a symbolic link from csbase to

     /Volummes/app/cs/csbase.

 

     - To get access to the modules, you typically include a

     BEGIN of the form:

 

         BEGIN {

             ...

             push (@INC, "../sys/csbase/lib");

         }

 

 

AUTHOR

     Clint Goss <clint@goss.com>, Feb 1997