CGI.pm
Encyclopedia
CGI.pm is a large and widely used Perl module
for programming
Common Gateway Interface
(CGI) web applications, providing a consistent API
for receiving user input and producing HTML
or XHTML
output.
The module was written Lincoln Stein
and is now maintained by Mark Stosberg.
style):
This would print a very simple webform, asking for your name and age, and after having been submitted, redisplaying the form with the name and age displayed below it. This sample makes use of CGI.pm's object-oriented abilities; it can also be done by calling functions directly, without the $cgi->.
Note: in many examples $q, short for query, is used to store a CGI object. As the above example illustrates, this might be very misleading.
Here is another script that produces the same output using CGI.pm's procedural
interface:
Perl module
A Perl module is a discrete component of software for the Perl programming language. Technically, it is a particular set of conventions for using Perl's package mechanism that has become universally adopted....
for programming
Computer programming
Computer programming is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs. This source code is written in one or more programming languages. The purpose of programming is to create a program that performs specific operations or exhibits a...
Common Gateway Interface
Common Gateway Interface
The Common Gateway Interface is a standard method for web servers software to delegate the generation of web pages to executable files...
(CGI) web applications, providing a consistent API
Application programming interface
An application programming interface is a source code based specification intended to be used as an interface by software components to communicate with each other...
for receiving user input and producing HTML
HTML
HyperText Markup Language is the predominant markup language for web pages. HTML elements are the basic building-blocks of webpages....
or XHTML
XHTML
XHTML is a family of XML markup languages that mirror or extend versions of the widely-used Hypertext Markup Language , the language in which web pages are written....
output.
The module was written Lincoln Stein
Lincoln Stein
Professor Lincoln D. Stein is a scientist and leader in bioinformatics and computational biology at the Ontario Institute for Cancer Research. Current projects include Reactome, WormBase,, BioPerl, , ENCODE , the Generic Model Organism Database and Cloud computing...
and is now maintained by Mark Stosberg.
A Sample CGI Page
Here is a simple CGI page, written in Perl using CGI.pm (in object orientedObject-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
style):
This would print a very simple webform, asking for your name and age, and after having been submitted, redisplaying the form with the name and age displayed below it. This sample makes use of CGI.pm's object-oriented abilities; it can also be done by calling functions directly, without the $cgi->.
Note: in many examples $q, short for query, is used to store a CGI object. As the above example illustrates, this might be very misleading.
Here is another script that produces the same output using CGI.pm's procedural
Procedural programming
Procedural programming can sometimes be used as a synonym for imperative programming , but can also refer to a programming paradigm, derived from structured programming, based upon the concept of the procedure call...
interface:
External links
- Official homepage
- CGI.pm – at the CPANCPANCPAN, the Comprehensive Perl Archive Network, is an archive of nearly 100,000 modules of software written in Perl, as well as documentation for it. It has a presence on the World Wide Web at and is mirrored worldwide at more than 200 locations...