Home
CGI Perl Tutorials
CGI Perl Tutorials
Perl Tutorials
Ads:
Introduction and Overview
What This Tutorial Is Not
What This Tutorial Will Provide
The Layout of This Tutorial
CPAN History
CPAN Motivation
CPAN Layout
A Perl5 Overview and Tutorial
Usability and Simplicity
Lexical Scoping
Data Structures
Modules and Libraries
Extensible and Embeddable
Enhanced Safety and Security
Other New Features in Perl5
References
The Short History of Perl Extensions
Modules and Extensions: Purpose and Design
A simple extension module.
Using the simple extension module.
Using a blessed reference to invoke methods from the Foo module.
The Customer module.
Using the Customer module.
Object-Oriented Techniques
Subclassing the Customer module.
Using the MyCust subclass.
Overriding Customers methods.
Using the overridden method in MyCust.
Augmenting base class methods.
Practical Issues for Using Modules: Downloading and Installation
Summary
Security on the Web
Server Configuration Options
File Permissions Setup and Monitoring Changes in the System
General ConsiderationsGlobal versus Local Configuration of Permissions
Directory Access Configuration
Whos There? Configuring Client IP/Domain Restrictions
Whos There? User/Group Verification
Changing Passwords from the Web
Monitoring Userids
General Considerations: Dos and Donts
Tools for Executing CGI Safely
The Safe Module
Transaction Security
Simplified PGP Transactions Using the PGP Module
Running httpd in the chroot(2)Environment
Problems with Specific Servers
Monitoring Filesystem Changes,Network Security, and Analyzing Password Security
Further Reading
HTML FormsThe Foundation of an Interactive Web
Text Fields
Password Fields
Radio Buttons
Checkboxes
Hidden Fields
Submit Buttons
Image Buttons
Listboxes
Popup Menus
File-Upload Fields
Image Maps
Generating HTML On-the-Fly with Perl5
Constructing Headers
Perl code for customer questionnaire.
Included Files
Perl subroutine for including another HTML file.
parsessi.pl CGI program for including and parsing a .shtml file.
Other Elements Within Elements
Perl code that emits a form formatted using the <TABLE> object.
Other Objects: Applets, Images, Animation, and the <EMBED> Tag
What Forms Cannot Provide
Putting It All Together
HTTP Transactions
The Connection
The Request
Web Browser Executing Perl as a Helper Application HelperAppPerl. PenguinA New Paradigm in Remote Execution Parsing Netscape History Files The Need for an Extended Session A very simple calculator A personal notepad. A Web-based command shell. Embedded ObjectsAn Internet Proposal Netscape Cookies and Other Netscape Feature Tags Summary
Table 5.1. HTTP FullRequest methods.
Table 5.2. URI Characters That Must Be Encoded.
Table 5.3. Headers.
What Happens after the Request
The Response
CGI.pm versus Individual libwww Modules
URL:
Using CGI.pm with forms
Open a new browser window
Example 3: Upload a File to the Server
Upload a file to the server
Using the HTTP::Request Module Directly
MIME Documents
MIME, WWW, and CGI
The Content-Type Header Field
How MIME Data Is Encoded
Q Quoted-Printable Encoding
Using MIME::Base64
MIME attachment
Using MIME::QuotedPrint
Determining Fields of Information
Setting Up the Database
Perl subroutine for printing the guest book form.
Perl subroutine to process the form data.
Main Perl guest book CGI program.
CGI program to display the guest list.
Setting Up the Web Server to Log Access
Parsing the Access Log
Perl subroutine to count the number of hits on a given page.
CGI script that displays a graphical hit counter.
Parsing the AgentLog
Clickable Maps
Creating an Image
Creating the Map
Clickable image CGI example.
Text File Search
Subroutine to return a search form.
Subroutine to search for a list of words.
Displaying the Results
A simple CGI searching program.
Displaying the Form
Subroutine to print a license plate form.
Subroutine to search for a specific license plate in the database.
Subroutine to print the information found about the license plate.
Subroutine for sending e-mail notification.
The license plate notification CGI program.
Database Access
DBI
Records to be imported into database
Program that imports data into an mSQL database
Create an HTML Index from a Database
Program that writes HTML from the database
about a single item in the database.
Searching the database for keywords
Open Database Connectivity (ODBC)
AgentsWeb Scanning, Mirroring, and Background Tasks
Stock Quotes on the Hour
HTML returned by the Security APL Quote Server.
Automatic stock quote retriever (getquote.pl).
Subroutine to extract the quote information.
General purpose URL retriever going through a firewall.
Generating Web Indexes
Web RobotsSpiders
The crawlIt() main function of the Web spider.
Converting a relative URL to an absolute URL.
Writing the title and URL to the log file.
Specifying the starting points and stopping points.
Mirroring Remote Sites
Modified function to convert relative URLs to absolute URLs.
Modified crawlIt() function for mirroring a site.
Search Engines
On-Site Searching with Glimpse
GlimpseHTTP
Search the Web with WWW::Search
a real world example of WWW::Search.
Datebooks, Calendars, and Scheduling on the Web
HyperCalA Modular Perl5 Calendar and Datebook
hypercal.cgi
Variables and configuration file for HyperCal.
Displaying Appointments on a Specific Day: disp_day.cgi
add_date.cgi.
password.change.
Multimedia
GD::Image Module
GD::Polygon Module
GD::Font Module
Hangman Using the GD Module
Server Push Animation Techniques
Embedding AVI, QuickTime, WAV, and GIF89a within HTML
Implementation Issues
Maintaining a Persistent State
Dynamic Generation of Forms
Security
MiniVend Package
Installation and Configuration
Overview of Features
Use and Customization
Setting Up Your Product Catalog
Setting Up Your minivend.cfg File
The main catalog page.
The search page.
The browse page.
The results display page.
The order page.
Frames
Additional Tools for Administration of Your Site
A Few Words About Security
General Archive Management Considerations
Planning, Design,and Layout
Revision Control
Summary of Archive Management Issues
General Parsing Issues
simpleparse.
simpleparse-net.
Editing and Verifying HTML
relativize.
Parsing HTTP Logfiles
GD_Logfile.pm.
GD_Logfile.test.
Converting Existing Documentation to HTML
Making Existing Archives Available via HTTP
Client-Side Perl
Embedded Perl Interpreter in aWeb Browser Executing Perl as a Helper Application HelperAppPerl. PenguinA New Paradigm in Remote Execution Parsing Netscape History Files The Need for an Extended Session A very simple calculator A personal notepad. A Web-based command shell. Embedded ObjectsAn Internet Proposal Netscape Cookies and Other Netscape Feature Tags Summary