Preface
Chapter 1 Introduction-Developing Interactive Web Applications
1.1 A Brief Look at The Internet and the World Wide Web
1.2 The HTTP Protocol
1.3 The Common Gateway Interface
1.4 An Example CGI Application
1.5 Programming Language Options
1.6 The Development Environment
1.7 HTML Forms
1.8 Programming Practices and Pitfalls
1.9 Summary
1.10 Exercises
Chapter 2-Basics of Perl and CGI Scripting
2.1 Starting a Perl Program
2.2 Working with Scalars
2.3 Interpolation in Strings
2.4 Standard Input and Standard Output
2.5 Returning CGI Documents
2.6 Getting Input-the QUERY_STRING Environment Variable
2.7 Asking Perl to Help You Find Problems: Warnings
2.8 Branching: Conditional Expressions and Operators
2.9 A First Look at Arrays and Hashes
2.10 More About Operators
2.11 Looping: Repetition Control Structures
2.12 Programming Practices and Pitfalls
2.13 Summary
2.14 Exercises
Chapter 3-Working with Forms, Patterns, and Files
3.1 Pattern Matching; Translating Form Data
3.2 Environment Variables and Request methods
3.3 A First Look at Files
3.4 Programming Practices and Pitfalls
3.5 Summary
3.6 Exercises
Chapter 4-Subroutines and Functions
4.1 Defining Subroutines
4.2 Arguments and Return Values
4.3 Variable Scope: my() and local()
4.4 A First Look at References
4.5 Building Libraries of Subroutines
4.6 Creating Versatile Programs: Packages and Modules
4.7 Creating Robust Applications: Using Standard Modules
4.8 Example: Site Maintenance
4.9 Programming Practices and Pitfalls
4.10 Summary
4.11 Exercises
Chapter 5-Files and Directories
5.1 Ways of Reading from Files
5.2 Designating a File as the Default
5.3 Operations on Files: Deleting, Renaming and Changing Permissions
5.4 File Test Operators
5.5 Standard Files
5.6 Example: A Simple Counter
5.7 Anonymous Filehandles; Passing Filehandles to Subroutines
5.8 File Locking Using flock()
5.9 File Locking Continued-Creating a Separate Lockfile
5.10 Working with Directories
5.11 Example: Search and Replace
5.12 Data Storage-DBM Databases and Hashes
5.13 Interacting with Other Programs
5.14 Example: Sending Mail with sendmail
5.15 Security Issues
5.16 Programming Practices and Pitfalls
5.17 Summary
5.18 Exercises
Chapter 6-A Closer Look
6.1 The Importance of Context
6.2 More About Strings
6.3 Looking into Data Structures with Data::Dumper
6.4 More About Arrays
6.5 Transforming a List with map()
6.7 Selecting Elements from a List with grep()
6.8 Sorting Lists with sort()
6.8 More About Hashes
6.9 Programming Practices and Pitfalls
6.10 Summary
6.11 Exercises
Chapter 7 Powerful Perl-References and Regular Expressions
7.1 Using References to Create Complex Data Structures
7.2 Example: XBM format graphics
7.3 Subroutine References and Dispatch Tables
7.4 Perl's Regular Expression Engine
7.5 Constructing Regular Expressions
7.6 Programming Practices and Pitfalls
7.7 Summary
7.8 Exercises
Chapter 8-Extending Perl with Modules
8.1 CPAN, the Comprehensive Perl Archive Network
8.2 Objects in Perl
8.3 Using CGI.pm for Parsing and Creating Forms
8.4 Uploading Files Using CGI.pm
8.5 Separating Design and Code: HTML::Template
8.6 Example: Putting it All Together
8.7 Sending Mail
8.8 Programming Practices and Pitfalls
8.9 Summary
8.10 Exercises
Chapter 9-Creating Persistent State Information
9.1 Trying to Preserve Information Status Under a Stateless Protocol
9.2 Hidden Variables
9.3 Session Files
9.4 Query and Extra Path Information
9.5 Persistent Client-side Cookies
9.6 Using CGI::SecureState
9.7 Example: Sadie's Shopping Cart
9.8 Programming Practices and Pitfalls
9.9 Summary
9.10 Exercises
Chapter 10-Data Management
10.1 Some Database Terminology
10.2 Delimited Text Files as Databases
10.3 SQL: the Structured Query Language
10.4 Interfacing with SQL Databases: The DBI and DBD modules
10.5 Example: Creating Sadie's Mailing List with DBD::CSV
10.6 Using the MySQL Database with DBD::mysql
10.7 Maintaining State with Apache::Session
10.8 Example: Building a Document Repository
10.9 Programming Practices and Pitfalls
10.10 Summary
10.11 Exercises
Chapter 11-WWW Access with LWP
11.1 libwww-perl
11.2 The LWP::Simple Module
11.3 The LWP Model: HTTP Style Communication
11.4 Web Robots
11.5 The HTTP::Daemon Module
11.6 References
11.7 Summary
11.8 Exercises
Chapter 12-On-the-fly Graphics with GD
12.1 The GD.pm Module
12.2 Polygons
12.3 Characters and Strings
12.4 Example: Drawing a Bar Chart
12.5 Working with an Existing Image
12.6 Copying Portions of Images
12.7 The GD::Graph Module
12.8 References
12.9 Summary
12.10 Exercises
Chapter 13-Security
13.1 What Can Go Wrong?
13.2 Don't Trust User Input
13.3 Directory Organization
13.4 File and Directory Permissions
13.5 Defensive Programming
13.6 Tainting
13.7 Using Encryption to Protect Data
13.8 References
13.9 Summary
13.10 Exercises
Appendices
A Setting up a Practice Site Under Windows
B A Few Unix Commands
C Server Side Includes
D Quick Reference: HTML Form Elements
E Quick Reference: Perl Functions
F Quick Reference: Perl Special Constants, Filehandles, and Variables
G Quick Reference: Symbols used in Perl Regular Expressions
Companion Web Site
Source code for all the example programs in the book
Links to online Perl and CGI resources, including download sites for software
A list of known errors and their corrections
A FAQ (Frequently Asked Questions) list