Perl Tutorials - Herong's Tutorial Examples - v6.01, by Dr. Herong Yang
cgi-lib.pl - The Standard Library for CGI Scripts
This section describes the de facto standard library, cgi-bin.pl, for Perl CGI scripts. It also provides a tutorial on how to download and install cgi-bin.pl 2.18 to the Apache server on a Windows system.
If you want to develop Web applications with Perl, you should download and use the CGI de facto standard library, cgi-lib.pl developed by Steven E. Brenner.
The cgi-lib.pl library makes CGI scripting in Perl easy enough for anyone to process forms and create dynamic Web content. The library has the following features:
Here is what I did to download and install cgi-lin.pl 2.18:
1. Go to http://cgi-lib.berkeley.edu/
2. Click the link "Version 2.18" in the "Current versions of cgi-lib available" section. The source code of cgi-lib.pl will be displayed in the browser.
3. Click "File > Save as" from the browser menu. The Save As dialog box shows up.
4. Save the content to C:\local\apache\cgi-bin\ directory and rename it to cgi-bin.pl.
See the next section for testing the cgi-bin.pl installation.
As Nils Kammenhuber commented in the Web version, DON'T use cgi-lib.pl! It is horribly outdated, the last version is from 1999, and it is said to have security issues. Instead, use Dancer2 or Mojolicious, or if you absolutely have to be compatible to the antique cgi-lib.pl then use the compatibility mode of CGI.pm.
Table of Contents
Data Types: Values and Variables
Expressions, Operations and Simple Statements
Name Spaces and Perl Module Files
Hard References - Addresses of Memory Objects
Objects (or References) and Classes (or Packages)
Typeglob and Importing Identifiers from Other Packages
String Built-in Functions and Performance
File Handles and Data Input/Output
Open Directories and Read File Names
File System Functions and Operations
Socket Communication Over the Internet
XML::Simple Module - XML Parser and Generator
SOAP::Lite - SOAP Server-Client Communication Module
Perl Programs as IIS Server CGI Scripts
CGI (Common Gateway Interface)
XML-RPC - Remote Procedure Call with XML and HTTP
RPC::XML - Perl Implementation of XML-RPC
►Integrating Perl with Apache Web Server
Downloading Apache HTTP Server 2.2.25 for Windows
Installing Apache HTTP Server 2.2.25 on Windows
Publishing HTML Documents as Web Pages
Starting and Stopping Apache Server
Running Perl Scripts in "cgi-bin"
printenv.pl - Testing Perl CGI Environment
►cgi-lib.pl - The Standard Library for CGI Scripts
ReadParse() - Parsing Web Form Input Values
Running Perl Scripts in "htdocs"
CGI.pm Module for Building Web Pages
LWP::UserAgent and Web Site Testing
Converting Perl Script to Executable Binary