CGI Modules for Perl 5
You can simplify many of the basic tasks of CGI programming
(such as creating and decoding forms) by using the freely
available CGI modules for Perl 5.
Several of these are available
from the Comprehensive Perl Archive Network (CPAN), the
mirror sites of which follow:
The current section gives an overview of some of the available modules.
The set of coordinated, commonly available CGI modules for
Perl 5 are known
collectively as the CGI::* modules. They are available from:
The CGI::* modules allow you to create and decode forms as
well as maintain state between forms.
A short description of each CGI::* module follows:
The core module that contains common methods (i.e., functions)
that some of the other classes depend on. These include
methods to read form information (the module does not
parse or decode the data), log debug messages, implement socket
I/O for maintaining state, and access and manipulate data
from environment variables, such as the client's acceptable
MIME content types.
Base.pm represents the base class (re: object-oriented
programming), from which other
classes "inherit" methods and data structures; the "child" classes
can override the methods from the base class to create modified
functions, or implement new ones.
A module consisting of functions to handle the new multipart forms
generated by "file upload"--a feature new to Netscape 2.0. This
very powerful feature allows users to send files on their local
machines as part of a form; however, decoding the data can be
a hassle. So you should use either this module or the
CGI_Lite module to handle multipart forms.
Module used to parse and decode form and query data.
A module to help you create forms without remembering and
entering every HTML tag. Also helps decode and parse
form and query data easily. The functions responsible
for this are inherited from the Base.pm and Request.pm
A module that lets you implement a "mini HTTP daemon" that can
be forked from a CGI application to maintain state between
multiple form invocations.
Though not part of the official CGI module distribution at the
time of this writing, this module contains functions that make
it easier to output HTML headers. For example, if you want
a document to be cached, you can call a method that will
automatically output the Pragma and Expires
headers for you.
An independent module (i.e., it does not inherit any functionality
from the base class), but very useful; it allows you to format
error messages sent to the server log file or redirect them to
the browser or another file.
There are also some independent CGI modules for Perl 5, among
An alternative to the CGI::* modules, this Perl 5 version
of cgi-lib.pl (a version 4 library)
decodes both URL-encoded
and multipart form data produced by the file upload feature
present in Netscape 2.0. CGI_Lite is simpler and
easier to use than the core CGI modules.
A Perl 5 module that
allows you to manipulate text-delimited databases (all data
and delimiters are text) using a small but important subset
of SQL-92. Sprite allows you to create your own
databases and access them in CGI scripts, even if you
don't have a database product like Sybase or Oracle.
CGI_Lite and Sprite can be found at any
of the CPAN mirror sites, under