Copyrighted Material

Copyrighted Material

TABLE OF CONTENTS HOW TO USE THIS BOOK . XII 1 INTRODUCING PERL AND APACHE WEB SITE DEVELOPMENT . 2 Introducing Apache and Perl ..................................................................................2 Introducing the Common Gateway Interface...........................................................4 Understanding CGI from the End-User’s Point of View ..........................................6 Understanding CGI from the Web Browser’s Point of View ....................................8 Understanding CGI from the Web Server’s Point of View .....................................10 Understanding CGI from the CGI Program’s Point of View ...................................12 Compare Perl to Other CGI Languages .................................................................14 Compare Apache to Other Web Servers ................................................................16 Developing Your Web Site....................................................................................18 Find Perl- and Apache-Friendly Hosting Providers ..............................................20 Find Help Developing CGI Programs ....................................................................22 2 INSTALLING PERL ON WINDOWS . 24 Introducing ActivePerl for Windows ....................................................................24 Introducing Strawberry Perl for Windows ............................................................25 Download ActivePerl for Windows .......................................................................26 Install ActivePerl for Windows .............................................................................28 Download Strawberry Perl for Windows ..............................................................30 Install Strawberry Perl for Windows ....................................................................32 3 INSTALLING PERL ON LINUX . 34 Install Perl for Debian/Ubuntu Linux ...................................................................34 Install Perl for Red Hat Linux ..............................................................................35 Download ActivePerlCOPYRIGHTED for Linux or Unix ...............................................................36 MATERIAL Install ActivePerl for Linux or Unix .....................................................................38 4 INSTALLING APACHE ON WINDOWS . 40 Download Apache for Windows ...........................................................................40 Install Apache for Windows .................................................................................42 Configure Apache on Windows ............................................................................44 Start and Stop the Apache Service on Windows ...................................................46 vi 002_556801-ftoc.indd2_556801-ftoc.indd vivi 88/31/10/31/10 99:15:15 AMAM 5 INSTALLING APACHE ON LINUX . 48 Install Apache for Debian/Ubuntu Linux .............................................................48 Install Apache for Red Hat Linux .........................................................................49 Configure Apache on Linux .................................................................................50 Start and Stop the Apache Service on Linux ........................................................52 6 INTRODUCING THE FUNDAMENTALS OF PERL . 54 Understanding Perl Syntax ..................................................................................54 Understanding the Anatomy of a Perl Script ........................................................57 Create a New Perl Script .......................................................................................58 Print Output to the Screen ...................................................................................60 Execute a Perl Script ............................................................................................62 Introducing Perl Scalars .......................................................................................64 Store Data into Scalars .........................................................................................66 Retrieve Data from Scalars ...................................................................................67 Introducing Perl Arrays ........................................................................................68 Store Data into Arrays .........................................................................................70 Retrieve Data from Arrays ...................................................................................71 Introducing Perl Hashes .......................................................................................72 Store Data into Hashes ........................................................................................74 Retrieve Data from Hashes ..................................................................................75 7 BUILDING AN INTERACTIVE PERL SCRIPT . 76 Introducing Perl Conditions ..................................................................................76 Introducing Perl Operators ...................................................................................78 Control Program Flow with if, elsif, else ..............................................................80 Introducing Perl Loops .........................................................................................82 Loop Program Flow with foreach, while ...............................................................84 Introducing Perl Subroutines ...............................................................................86 Organize Program Code with Subroutines ............................................................88 Manipulate Variables in Subroutines ...................................................................90 8 USING PERL REFERENCES AND MODULES . 92 Introducing References ........................................................................................92 Understanding Compound Data Structures ..........................................................94 Build an Array or Hash Reference .......................................................................96 vii 002_556801-ftoc.indd2_556801-ftoc.indd viivii 88/31/10/31/10 99:15:15 AMAM TABLE OF CONTENTS Deconstruct a Reference .......................................................................................98 Nest Variable Types with References .................................................................100 Introducing Perl Modules ...................................................................................102 Create a New Module .........................................................................................104 Call a Module’s Subroutines as Methods ............................................................106 9 INSTALLING THIRD-PARTY PERL MODULES . 108 Introducing CPAN ..............................................................................................108 Configure CPAN .................................................................................................110 Search for Perl Modules with CPAN ...................................................................111 Install Perl Modules with CPAN .........................................................................112 Introducing ActivePerl Perl Package Manager ....................................................114 Configure ActivePerl PPM ..................................................................................116 Search for Perl Modules with ActivePerl PPM ....................................................118 Install Perl Modules with ActivePerl PPM ..........................................................119 Search for Perl Modules in Debian/Ubuntu Linux ..............................................120 Install Perl Modules in Debian/Ubuntu Linux ....................................................121 Search for Perl Modules in Red Hat Linux .........................................................122 Install Perl Modules in Red Hat Linux ...............................................................123 Search for and Download Perl Modules Manually ..............................................124 Build and Install Perl Modules Manually ...........................................................126 10 CONFIGURING APACHE TO EXECUTE PERL . 128 Introducing the Apache CGI Handler ..................................................................128 Create a User Directory for Apache in Windows ................................................130 Create a User Directory for Apache in Linux ......................................................132 Enable the Apache CGI Module and Handler ......................................................134 Configure a Directory to Use the CGI Handler ....................................................136 Understanding the Apache Logs ........................................................................138 Configure the Apache Logs ................................................................................139 Read the Apache Logs .......................................................................................140 Forward Perl Activity into the Apache Logs .......................................................141 11 INTRODUCING DO-IT-YOURSELF PERL/CGI INTERACTION . 142 Create an HTML Form ........................................................................................142 Read HTTP GET/POST Parameters .....................................................................144

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us