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:
ftp://ftp.funet.fi/pub/languages/perl/CPAN/ ftp://ftp.cis.ufl.edu/pub/perl/CPAN/ ftp://ftp.uiarchive.cso.uiuc.edu/pub/lang/perl/CPAN/ ftp://ftp.delphi.com/pub/mirrors/packages/perl/CPAN/ ftp://ftp.uoknor.edu/mirrors/CPAN/ ftp://ftp.sedl.org/pub/mirrors/CPAN/ ftp://ftp.ibp.fr/pub/perl/CPAN/ ftp://ftp.pasteur.fr/pub/computing/unix/perl/CPAN/ ftp://ftp.leo.org/pub/comp/programming/languages/perl/CPAN/ ftp://ftp.rz.ruhr-uni-bochum.de/pub/programming/languages/perl/CPAN/ ftp://ftp.demon.co.uk/pub/mirrors/perl/CPAN/ ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/ ftp://ftp.sunet.se/pub/lang/perl/CPAN/ ftp://ftp.switch.ch/mirror/CPAN/ ftp://ftp.mame.mu.oz.au/pub/perl/CPAN/ ftp://ftp.tekotago.ac.nz/pub/perl/CPAN/ ftp://ftp.lab.kdd.co.jp/lang/perl/CPAN/ ftp://dongpo.math.ncu.edu.tw/perl/CPAN/ ftp://ftp.is.co.za.programming/perl/CPAN/
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 modules.
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 them:
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 /modules/by-authors/Shishir_Gundavaram.
The following libraries and modules are available for use with Perl 4 and/or other languages/platforms:
modules/by-authors/Gisle_A in the CPAN archives
modules/by-authors/Shishir_Gundavaram in the CPAN archives
authors/Tim_Bunce/DBI in the CPAN archives
/doc/FAQ in the CPAN archives