19.1. The CGI.pm Module

Starting with the 5.004 release, the standard Perl distribution includes the all-singing, all-dancing CGI.pm module.[1]

[1] If you have an earlier release of Perl (but at least Version 5.001) and haven't gotten around to upgrading yet, just grab CGI.pm from CPAN.

Written by Lincoln Stein, author of the acclaimed book How to Setup and Maintain Your Web Site, this module makes writing CGI programs in Perl a breeze. Like Perl itself, CGI.pm is platform independent, so you can use it on systems running everything from UNIX and Linux to VMS; it even runs on systems like Windows and the MacOS.

Assuming CGI.pm is already installed on your system, you can read its complete documentation in whatever fashion you're used to reading the Perl manpages, such as with the man (1) or perldoc (1) commands or as HTML. If all else fails, just read the CGI.pm file: the documentation for the module is embedded in the module itself, written in simple pod format.[2]

[2] Pod stands for "plain old documentation," the simplistic mark-up used for all Perl documentation. See the perlpod (1) manpage for how it works, plus pod2man (1), pod2html (1), or pod2text (1) for some of the pod translators.

While developing CGI programs, keep a copy of the CGI.pm manpage handy. Not only does it describe the module's functions, it's also loaded with examples and tips.

Get Learning Perl, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.