Perl and Apache: Your visual blueprint for developing dynamic Web content

Book description

Visually explore the range of built-in and third-party libraries of Perl and Apache

Perl and Apache have been providing Common Gateway Interface (CGI) access to Web sites for 20 years and are constantly evolving to support the ever-changing demands of Internet users. With this book, you will heighten your knowledge and see how to usePerl and Apache to develop dynamic Web sites.

Beginning with a clear, step-by-step explanation of how to install Perl and Apache on both Windows and Linux servers, you then move on to configuring each to securely provide CGI Services. CGI developer and author Adam McDaniel shows techniques for effectively developing and maintaining dynamic sites and he shares real-world examples describing MySQL database access, PayPal credit-card transactions, and sample Facebook and Twitter interfaces.

  • Apache and Perl have been providing Common Gateway Interface (CGI) access to Internet Web sites for more than two decades, and both products are constantly evolving to support today's user requirements

  • Shows how to install Perl and Apache on Windows and Linux servers and configure each to securely provide CGI services

  • Details techniques for effectively developing and maintaining dynamic Web sites

  • Addresses MySQL database access and PayPal credit-card transactions, and examines sample Facebook and Twitter interfaces

With this book, you'll benefit from a wealth of techniques and resources that you won't find anywhere else.

Table of contents

  1. Copyright
  2. Credits
  3. About the Author
  4. Author's Acknowledgments
  5. How to Use This Book
  6. 1. INTRODUCING PERL AND APACHE WEB SITE DEVELOPMENT
    1. 1.1. Introducing Apache and Perl
    2. 1.2. Introducing the Common Gateway Interface
    3. 1.3. Understanding CGI from the End-User's Point of View
    4. 1.4. Understanding CGI from the Web Browser's Point of View
    5. 1.5. Understanding CGI from the Web Server's Point of View
    6. 1.6. Understanding CGI from the CGI Program's Point of View
    7. 1.7. Compare Perl to Other CGI Languages
    8. 1.8. Compare Apache to Other Web Servers
    9. 1.9. Developing Your Web Site
    10. 1.10. Find Perl- and Apache-Friendly Hosting Providers
    11. 1.11. Find Help Developing CGI Programs
  7. 2. INSTALLING PERL ON WINDOWS
    1. 2.1. Introducing ActivePerl for Windows
    2. 2.2. Introducing Strawberry Perl for Windows
    3. 2.3. Download ActivePerl for Windows
    4. 2.4. Install ActivePerl for Windows
    5. 2.5. Download Strawberry Perl for Windows
    6. 2.6. Install Strawberry Perl for Windows
  8. 3. INSTALLING PERL ON LINUX
    1. 3.1. Install Perl for Debian/Ubuntu Linux
    2. 3.2. Install Perl for Red Hat Linux
    3. 3.3. Download ActivePerl for Linux or Unix
    4. 3.4. Install ActivePerl for Linux or Unix
  9. 4. INSTALLING APACHE ON WINDOWS
    1. 4.1. Download Apache for Windows
    2. 4.2. Install Apache for Windows
    3. 4.3. Configure Apache on Windows
    4. 4.4. Start and Stop the Apache Service on Windows
  10. 5. INSTALLING APACHE ON LINUX
    1. 5.1. Install Apache for Debian/Ubuntu Linux
    2. 5.2. Install Apache for Red Hat Linux
    3. 5.3. Configure Apache on Linux
    4. 5.4. Start and Stop the Apache Service on Linux
  11. 6. INTRODUCING THE FUNDAMENTALS OF PERL
    1. 6.1. Understanding Perl Syntax
    2. 6.2. Understanding the Anatomy of a Perl Script
    3. 6.3. Create a New Perl Script
    4. 6.4. Print Output to the Screen
    5. 6.5. Execute a Perl Script
    6. 6.6. Introducing Perl Scalars
    7. 6.7. Store Data into Scalars
    8. 6.8. Retrieve Data from Scalars
    9. 6.9. Introducing Perl Arrays
    10. 6.10. Store Data into Arrays
    11. 6.11. Retrieve Data from Arrays
    12. 6.12. Introducing Perl Hashes
    13. 6.13. Store Data into Hashes
    14. 6.14. Retrieve Data from Hashes
  12. 7. BUILDING AN INTERACTIVE PERL SCRIPT
    1. 7.1. Introducing Perl Conditions
    2. 7.2. Introducing Perl Operators
    3. 7.3. Control Program Flow with if, elsif, else
    4. 7.4. Introducing Perl Loops
    5. 7.5. Loop Program Flow with foreach, while
    6. 7.6. Introducing Perl Subroutines
    7. 7.7. Organize Program Code with Subroutines
    8. 7.8. Manipulate Variables in Subroutines
  13. 8. USING PERL REFERENCES AND MODULES
    1. 8.1. Introducing References
    2. 8.2. Understanding Compound Data Structures
    3. 8.3. Build an Array or Hash Reference
    4. 8.4. Deconstruct a Reference
    5. 8.5. Nest Variable Types with References
    6. 8.6. Introducing Perl Modules
    7. 8.7. Create a New Module
    8. 8.8. Call a Module's Subroutines as Methods
  14. 9. INSTALLING THIRD-PARTY PERL MODULES
    1. 9.1. Introducing CPAN
    2. 9.2. Configure CPAN
    3. 9.3. Search for Perl Modules with CPAN
    4. 9.4. Install Perl Modules with CPAN
    5. 9.5. Introducing ActivePerl Perl Package Manager
    6. 9.6. Configure ActivePerl PPM
    7. 9.7. Search for Perl Modules with ActivePerl PPM
    8. 9.8. Install Perl Modules with ActivePerl PPM
    9. 9.9. Search for Perl Modules in Debian/Ubuntu Linux
    10. 9.10. Install Perl Modules in Debian/Ubuntu Linux
    11. 9.11. Search for Perl Modules in Red Hat Linux
    12. 9.12. Install Perl Modules in Red Hat Linux
    13. 9.13. Search for and Download Perl Modules Manually
    14. 9.14. Build and Install Perl Modules Manually
  15. 10. CONFIGURING APACHE TO EXECUTE PERL
    1. 10.1. Introducing the Apache CGI Handler
    2. 10.2. Create a User Directory for Apache in Windows
    3. 10.3. Create a User Directory for Apache in Linux
    4. 10.4. Enable the Apache CGI Module and Handler
    5. 10.5. Configure a Directory to Use the CGI Handler
    6. 10.6. Understanding the Apache Logs
    7. 10.7. Configure the Apache Logs
    8. 10.8. Read the Apache Logs
    9. 10.9. Forward Perl Activity into the Apache Logs
  16. 11. INTRODUCING DO-IT-YOURSELF PERL/CGI INTERACTION
    1. 11.1. Create an HTML Form
    2. 11.2. Read HTTP GET/POST Parameters
    3. 11.3. Introducing Cookies
    4. 11.4. Store HTTP Cookies
    5. 11.5. Retrieve HTTP Cookies
    6. 11.6. Send an E-Mail Message
  17. 12. USING PERL'S BUILT-IN CGI LIBRARY
    1. 12.1. Introducing the Built-In CGI Library
    2. 12.2. Import the CGI Library as an Object
    3. 12.3. Import the CGI Library's Routines as Functions
    4. 12.4. Read HTTP GET/POST Parameters with the CGI Library
    5. 12.5. Store HTTP Cookies with the CGI Library
    6. 12.6. Retrieve HTTP Cookies with the CGI Library
    7. 12.7. Return Useful Error Messages with CGI::Carp
  18. 13. SEPARATING HTML CODE FROM PERL CODE
    1. 13.1. Understanding the Benefits of Separating HTML from Perl
    2. 13.2. Introducing the Perl HTML::Template Module
    3. 13.3. Understanding the Structure of an HTML::Template File
    4. 13.4. Create a New Template File
    5. 13.5. Import the HTML::Template Module
    6. 13.6. Display Data with TMPL_VAR
    7. 13.7. Control Template Content with TMPL_IF, TMPL_ELSE
    8. 13.8. Repeat Template Content with TMPL_LOOP
    9. 13.9. Nest Templates with TMPL_INCLUDE
    10. 13.10. Create an HTML::Template Header and Footer
    11. 13.11. Create an HTML::Template Toolbar
    12. 13.12. Link the Header, Toolbar, and Footer with Dynamic Perl Content
    13. 13.13. Extend HTML::Template to Non-HTML Formats
  19. 14. ADDING DYNAMIC CONTENT WITH SERVER-SIDE INCLUDES (SSI)
    1. 14.1. Introducing Server-Side Includes
    2. 14.2. Enable the Apache SSI Module and Output Filter
    3. 14.3. Configure a Directory to Use SSI
    4. 14.4. Understanding SSI Elements
    5. 14.5. Import Files with SSI
    6. 14.6. Execute Programs with SSI
    7. 14.7. Set Variables within SSI
    8. 14.8. Retrieve Variables with SSI
    9. 14.9. Use Conditional Expressions with SSI
    10. 14.10. Display File Statistics with SSI
    11. 14.11. Link the Header, Toolbar, and Footer with Static HTML Content
  20. 15. AUTHENTICATING A USER SESSION
    1. 15.1. Understanding Apache User Authentication
    2. 15.2. Secure a Directory Path with Apache
    3. 15.3. Use an Authentication Password File
    4. 15.4. Require Only Authorized Users
    5. 15.5. Understanding User Authentication in Perl
    6. 15.6. Create a Perl Authentication Module
    7. 15.7. Access a User's Database
    8. 15.8. Store User Credentials in a User's Database
    9. 15.9. Check for Session Authorization (Step 1)
    10. 15.10. Display a Login Prompt (Step 2)
    11. 15.11. Validate a User's Credentials (Step 3)
    12. 15.12. Authorize a User's Session (Step 4)
    13. 15.13. Restrict Access to a CGI Script
    14. 15.14. Terminate a User Session
  21. 16. INTERFACING YOUR WEB SITE WITH FACEBOOK
    1. 16.1. Register Your Web Site as a Facebook Application
    2. 16.2. Add a Facebook Social Plugin to Your Web Site
    3. 16.3. Enable Facebook Connect on Your Web Site
    4. 16.4.
    5. 16.5. Understanding the Facebook Canvas Feature for Applications
    6. 16.6. Create a Facebook Application with Perl
  22. 17. INTERFACING WITH THE TWITTER API USING PERL
    1. 17.1. Introducing the Twitter APIs
    2. 17.2. Introducing the Perl Twitter Modules
    3. 17.3. Register a New Twitter Application
    4. 17.4. Authenticate to Twitter Using OAuth
    5. 17.5. Create a MyTwitter Perl Module That Inherits Net::Twitter
    6. 17.6. Post a Twitter Status Update
    7. 17.7. Retrieve a Twitter Timeline
    8. 17.8. Retrieve a List of Twitter Users You Follow
    9. 17.9. Retrieve a List of Twitter Followers
    10. 17.10. Search for Content Using the Twitter Search API
    11. 17.11. Use the Twitter @Anywhere JavaScript API
    12. 17.12. Follow Real-Time Activity with the Twitter Streaming API
  23. 18. CREATING DYNAMIC IMAGES WITH PERL
    1. 18.1. Accept a File for Upload
    2. 18.2. Open an Image with Image::Magick
    3. 18.3. Resize or Crop an Image with Image::Magick
    4. 18.4. Manipulate an Image with Image::Magick
    5. 18.5. Save an Image to Disk
    6. 18.6. Display a Dynamic Image to the Browser
    7. 18.7. Implement an Image Captcha Test
    8. 18.8. Produce an Image Gallery
  24. 19. FACILITATING DYNAMIC AJAX CALLS WITH PERL
    1. 19.1. Introducing AJAX
    2. 19.2. Introducing CGI::Ajax
    3. 19.3. Add CGI::Ajax into Your Perl CGI Scripts
    4. 19.4. Call Perl Subroutines Through JavaScript
    5. 19.5. Call JavaScript Through Perl Subroutines
    6. 19.6. Enable Debug Mode in CGI::Ajax
    7. 19.7. Integrate Perl and XML
    8. 19.8. Integrate Perl and JSON
  25. 20. PROCESSING CREDIT CARD TRANSACTIONS WITH PERL
    1. 20.1. Introducing PayPal
    2. 20.2. Sign Up for a PayPal Sandbox Account
    3. 20.3. Create Buyer and Seller Sandbox Accounts
    4. 20.4. Retrieve Your Seller's Sandbox API Credentials
    5. 20.5. Use Business::PayPal::NVP to Connect to PayPal
    6. 20.6. Process a Credit Card Payment with PayPal
    7. 20.7. Use the PayPal Express Checkout API
    8. 20.8. Search Your PayPal Transaction History
    9. 20.9. View a PayPal Transaction's Details
    10. 20.10. Refund a PayPal Transaction
  26. 21. ACCESSING A BACK-END MYSQL DATABASE WITH PERL
    1. 21.1. Introducing the MySQL Database
    2. 21.2. Understanding the SQL Syntax
    3. 21.3. Download MySQL for Windows
    4. 21.4. Install MySQL for Windows
    5. 21.5. Install MySQL for Debian/Ubuntu Linux
    6. 21.6. Install MySQL for Red Hat Linux
    7. 21.7. Introducing the Perl DBI Library
    8. 21.8. Connect to a MySQL Database with the DBI Library
    9. 21.9. Retrieve SQL Data Using the DBI Library
    10. 21.10. Display SQL Data Through HTML::Template
    11. 21.11. Change SQL Data Using the DBI Library
  27. 22. SECURING DYNAMIC WEB SITES
    1. 22.1. Understanding TLS/SSL Encryption
    2. 22.2. Create a Private SSL Key
    3. 22.3. Generate an SSL Certificate Signing Request
    4. 22.4. Sign Your Own CSR to Create a Test SSL Certificate
    5. 22.5. Submit Your CSR to Be Signed by a Certificate Authority
    6. 22.6. Configure Apache to Use TLS/SSL
    7. 22.7. Understanding Security in Perl CGI Development
    8. 22.8. Limit CGI Access in Apache
    9. 22.9. Identify Unusual Activity on Your Web Site
    10. 22.10. Sanitize User Content in Perl CGI
    11. 22.11. Validate User Content in Perl CGI
  28. 23. SPEEDING UP DYNAMIC WEB SITES
    1. 23.1. Introducing the Apache mod_perl Module
    2. 23.2. Install the Apache mod_perl Module for Windows
    3. 23.3. Install the Apache mod_perl Module for Linux
    4. 23.4. Configure the Apache mod_perl Module
    5. 23.5. Understanding mod_perl's Caveats
  29. A. PERL REFERENCE
    1. A.1. Access Perl Documentation
    2. A.2. Execute Perl on the Command-Line
    3. A.3. Available Built-In Perl Functions
    4. A.4. Using Perl Pre-Defined Variables
    5. A.5. Perl Operators
    6. A.6. Perl Regular Expressions
  30. B. APACHE CONFIGURE AND MODULE REFERENCE
    1. B.1. Apache Run-Time Configuration Directives
    2. B.2. Apache Base Modules and Directives
    3. B.3. Apache Authentication and Authorization Modules and Directives
    4. B.4. Apache Extended Modules and Directives
  31. C. USEFUL PERL MODULES
    1. C.1. Useful Perl Modules

Product information

  • Title: Perl and Apache: Your visual blueprint for developing dynamic Web content
  • Author(s):
  • Release date: October 2010
  • Publisher(s): Visual
  • ISBN: 9780470556801