Cover image for Perl Cookbook, 2nd Edition

Book description

Find a Perl programmer, and you'll find a copy of PerlCookbook nearby. Perl Cookbook is a comprehensivecollection of problems, solutions, and practical examples foranyone programming in Perl. The book contains hundreds ofrigorously reviewed Perl "recipes" and thousands of examplesranging from brief one-liners to complete applications. The secondedition of Perl Cookbook has been fully updated for Perl5.8, with extensive changes for Unicode support, I/O layers,mod_perl, and new technologies that have emerged since the previousedition of the book. Recipes have been updated to include thelatest modules. New recipes have been added to every chapter of thebook, and some chapters have almost doubled in size. Covered topicareas include:

  • Manipulating strings, numbers, dates, arrays, and hashes

  • Pattern matching and text substitutions

  • References, data structures, objects, and classes

  • Signals and exceptions

  • Screen addressing, menus, and graphical applications

  • Managing other processes

  • Writing secure scripts

  • Client-server programming

  • Internet applications programming with mail, news, ftp, andtelnet

  • CGI and mod_perl programming

  • Web programming

Since its first release in 1998, Perl Cookbook has earnedits place in the libraries of serious Perl users of all levels ofexpertise by providing practical answers, code examples, andmini-tutorials addressing the challenges that programmers face. Nowthe second edition of this bestselling book is ready to earn itsplace among the ranks of favorite Perl books as well. Whetheryou're a novice or veteran Perl programmer, you'll find PerlCookbook, 2nd Edition to be one of the most useful books onPerl available. Its comfortable discussion style and accurateattention to detail cover just about any topic you'd want to knowabout. You can get by without having this book in your library, butonce you've tried a few of the recipes, you won't want to.

Table of Contents

  1. Perl Cookbook, 2nd Edition
  2. A Note Regarding Supplemental Files
  3. Foreword
  4. Preface
    1. What's in This Book
    2. What's New in This Edition
    3. Platform Notes
    4. Other Books
    5. Conventions Used in This Book
      1. Programming Conventions
      2. Typesetting Conventions
      3. Documentation Conventions
    6. We'd Like to Hear from You
    7. Acknowledgments for the First Edition
      1. Tom
      2. Nat
    8. Acknowledgments for the Second Edition
      1. Tom
      2. Nat
  5. 1. Strings
    1. Introduction
      1. The Universal Character Code
      2. Unicode Support in Perl
    2. 1.1. Accessing Substrings
      1. 1.1.1. Problem
      2. 1.1.2. Solution
      3. 1.1.3. Discussion
      4. 1.1.4. See Also
    3. 1.2. Establishing a Default Value
      1. 1.2.1. Problem
      2. 1.2.2. Solution
      3. 1.2.3. Discussion
      4. 1.2.4. See Also
    4. 1.3. Exchanging Values Without Using Temporary Variables
      1. 1.3.1. Problem
      2. 1.3.2. Solution
      3. 1.3.3. Discussion
      4. 1.3.4. See Also
    5. 1.4. Converting Between Characters and Values
      1. 1.4.1. Problem
      2. 1.4.2. Solution
      3. 1.4.3. Discussion
      4. 1.4.4. See Also
    6. 1.5. Using Named Unicode Characters
      1. 1.5.1. Problem
      2. 1.5.2. Solution
      3. 1.5.3. Discussion
      4. 1.5.4. See Also
    7. 1.6. Processing a String One Character at a Time
      1. 1.6.1. Problem
      2. 1.6.2. Solution
      3. 1.6.3. Discussion
      4. 1.6.4. See Also
    8. 1.7. Reversing a String by Word or Character
      1. 1.7.1. Problem
      2. 1.7.2. Solution
      3. 1.7.3. Discussion
      4. 1.7.4. See Also
    9. 1.8. Treating Unicode Combined Characters as Single Characters
      1. 1.8.1. Problem
      2. 1.8.2. Solution
      3. 1.8.3. Discussion
      4. 1.8.4. See Also
    10. 1.9. Canonicalizing Strings with Unicode Combined Characters
      1. 1.9.1. Problem
      2. 1.9.2. Solution
      3. 1.9.3. Discussion
      4. 1.9.4. See Also
    11. 1.10. Treating a Unicode String as Octets
      1. 1.10.1. Problem
      2. 1.10.2. Solution
      3. 1.10.3. Discussion
      4. 1.10.4. See Also
    12. 1.11. Expanding and Compressing Tabs
      1. 1.11.1. Problem
      2. 1.11.2. Solution
      3. 1.11.3. Discussion
      4. 1.11.4. See Also
    13. 1.12. Expanding Variables in User Input
      1. 1.12.1. Problem
      2. 1.12.2. Solution
      3. 1.12.3. Discussion
      4. 1.12.4. See Also
    14. 1.13. Controlling Case
      1. 1.13.1. Problem
      2. 1.13.2. Solution
      3. 1.13.3. Discussion
      4. 1.13.4. See Also
    15. 1.14. Properly Capitalizing a Title or Headline
      1. 1.14.1. Problem
      2. 1.14.2. Solution
      3. 1.14.3. Discussion
      4. 1.14.4. See Also
    16. 1.15. Interpolating Functions and Expressions Within Strings
      1. 1.15.1. Problem
      2. 1.15.2. Solution
      3. 1.15.3. Discussion
      4. 1.15.4. See Also
    17. 1.16. Indenting Here Documents
      1. 1.16.1. Problem
      2. 1.16.2. Solution
      3. 1.16.3. Discussion
      4. 1.16.4. See Also
    18. 1.17. Reformatting Paragraphs
      1. 1.17.1. Problem
      2. 1.17.2. Solution
      3. 1.17.3. Discussion
      4. 1.17.4. See Also
    19. 1.18. Escaping Characters
      1. 1.18.1. Problem
      2. 1.18.2. Solution
      3. 1.18.3. Discussion
      4. 1.18.4. See Also
    20. 1.19. Trimming Blanks from the Ends of a String
      1. 1.19.1. Problem
      2. 1.19.2. Solution
      3. 1.19.3. Discussion
      4. 1.19.4. See Also
    21. 1.20. Parsing Comma-Separated Data
      1. 1.20.1. Problem
      2. 1.20.2. Solution
      3. 1.20.3. Discussion
      4. 1.20.4. See Also
    22. 1.21. Constant Variables
      1. 1.21.1. Problem
      2. 1.21.2. Solution
      3. 1.21.3. Discussion
      4. 1.21.4. See Also
    23. 1.22. Soundex Matching
      1. 1.22.1. Problem
      2. 1.22.2. Solution
      3. 1.22.3. Discussion
      4. 1.22.4. See Also
    24. 1.23. Program: fixstyle
    25. 1.24. Program: psgrep
  6. 2. Numbers
    1. Introduction
    2. 2.1. Checking Whether a String Is a Valid Number
      1. 2.1.1. Problem
      2. 2.1.2. Solution
      3. 2.1.3. Discussion
      4. 2.1.4. See Also
    3. 2.2. Rounding Floating-Point Numbers
      1. 2.2.1. Problem
      2. 2.2.2. Solution
      3. 2.2.3. Discussion
      4. 2.2.4. See Also
    4. 2.3. Comparing Floating-Point Numbers
      1. 2.3.1. Problem
      2. 2.3.2. Solution
      3. 2.3.3. Discussion
      4. 2.3.4. See Also
    5. 2.4. Operating on a Series of Integers
      1. 2.4.1. Problem
      2. 2.4.2. Solution
      3. 2.4.3. Discussion
      4. 2.4.4. See Also
    6. 2.5. Working with Roman Numerals
      1. 2.5.1. Problem
      2. 2.5.2. Solution
      3. 2.5.3. Discussion
      4. 2.5.4. See Also
    7. 2.6. Generating Random Numbers
      1. 2.6.1. Problem
      2. 2.6.2. Solution
      3. 2.6.3. Discussion
      4. 2.6.4. See Also
    8. 2.7. Generating Repeatable Random Number Sequences
      1. 2.7.1. Problem
      2. 2.7.2. Solution
      3. 2.7.3. Discussion
      4. 2.7.4. See Also
    9. 2.8. Making Numbers Even More Random
      1. 2.8.1. Problem
      2. 2.8.2. Solution
      3. 2.8.3. Discussion
      4. 2.8.4. See Also
    10. 2.9. Generating Biased Random Numbers
      1. 2.9.1. Problem
      2. 2.9.2. Solution
      3. 2.9.3. Discussion
      4. 2.9.4. See Also
    11. 2.10. Doing Trigonometry in Degrees, Not Radians
      1. 2.10.1. Problem
      2. 2.10.2. Solution
      3. 2.10.3. Discussion
      4. 2.10.4. See Also
    12. 2.11. Calculating More Trigonometric Functions
      1. 2.11.1. Problem
      2. 2.11.2. Solution
      3. 2.11.3. Discussion
      4. 2.11.4. See Also
    13. 2.12. Taking Logarithms
      1. 2.12.1. Problem
      2. 2.12.2. Solution
      3. 2.12.3. Discussion
      4. 2.12.4. See Also
    14. 2.13. Multiplying Matrices
      1. 2.13.1. Problem
      2. 2.13.2. Solution
      3. 2.13.3. Discussion
      4. 2.13.4. See Also
    15. 2.14. Using Complex Numbers
      1. 2.14.1. Problem
      2. 2.14.2. Solution
      3. 2.14.3. Discussion
      4. 2.14.4. See Also
    16. 2.15. Converting Binary, Octal, and Hexadecimal Numbers
      1. 2.15.1. Problem
      2. 2.15.2. Solution
      3. 2.15.3. Discussion
      4. 2.15.4. See Also
    17. 2.16. Putting Commas in Numbers
      1. 2.16.1. Problem
      2. 2.16.2. Solution
      3. 2.16.3. Discussion
      4. 2.16.4. See Also
    18. 2.17. Printing Correct Plurals
      1. 2.17.1. Problem
      2. 2.17.2. Solution
      3. 2.17.3. Discussion
      4. 2.17.4. See Also
    19. 2.18. Program: Calculating Prime Factors
  7. 3. Dates and Times
    1. Introduction
    2. 3.1. Finding Today's Date
      1. 3.1.1. Problem
      2. 3.1.2. Solution
      3. 3.1.3. Discussion
      4. 3.1.4. See Also
    3. 3.2. Converting DMYHMS to Epoch Seconds
      1. 3.2.1. Problem
      2. 3.2.2. Solution
      3. 3.2.3. Discussion
      4. 3.2.4. See Also
    4. 3.3. Converting Epoch Seconds to DMYHMS
      1. 3.3.1. Problem
      2. 3.3.2. Solution
      3. 3.3.3. Discussion
      4. 3.3.4. See Also
    5. 3.4. Adding to or Subtracting from a Date
      1. 3.4.1. Problem
      2. 3.4.2. Solution
      3. 3.4.3. Discussion
      4. 3.4.4. See Also
    6. 3.5. Difference of Two Dates
      1. 3.5.1. Problem
      2. 3.5.2. Solution
      3. 3.5.3. Discussion
      4. 3.5.4. See Also
    7. 3.6. Day in a Week/Month/Year or Week Number
      1. 3.6.1. Problem
      2. 3.6.2. Solution
      3. 3.6.3. Discussion
      4. 3.6.4. See Also
    8. 3.7. Parsing Dates and Times from Strings
      1. 3.7.1. Problem
      2. 3.7.2. Solution
      3. 3.7.3. Discussion
      4. 3.7.4. See Also
    9. 3.8. Printing a Date
      1. 3.8.1. Problem
      2. 3.8.2. Solution
      3. 3.8.3. Discussion
      4. 3.8.4. See Also
    10. 3.9. High-Resolution Timers
      1. 3.9.1. Problem
      2. 3.9.2. Solution
      3. 3.9.3. Discussion
      4. 3.9.4. See Also
    11. 3.10. Short Sleeps
      1. 3.10.1. Problem
      2. 3.10.2. Solution
      3. 3.10.3. Discussion
      4. 3.10.4. See Also
    12. 3.11. Program: hopdelta
  8. 4. Arrays
    1. Introduction
    2. 4.1. Specifying a List in Your Program
      1. 4.1.1. Problem
      2. 4.1.2. Solution
      3. 4.1.3. Discussion
      4. 4.1.4. See Also
    3. 4.2. Printing a List with Commas
      1. 4.2.1. Problem
      2. 4.2.2. Solution
      3. 4.2.3. Discussion
      4. 4.2.4. See Also
    4. 4.3. Changing Array Size
      1. 4.3.1. Problem
      2. 4.3.2. Solution
      3. 4.3.3. Discussion
      4. 4.3.4. See Also
    5. 4.4. Implementing a Sparse Array
      1. 4.4.1. Problem
      2. 4.4.2. Solution
      3. 4.4.3. Discussion
      4. 4.4.4. See Also
    6. 4.5. Iterating Over an Array
      1. 4.5.1. Problem
      2. 4.5.2. Solution
      3. 4.5.3. Discussion
      4. 4.5.4. See Also
    7. 4.6. Iterating Over an Array by Reference
      1. 4.6.1. Problem
      2. 4.6.2. Solution
      3. 4.6.3. Discussion
      4. 4.6.4. See Also
    8. 4.7. Extracting Unique Elements from a List
      1. 4.7.1. Problem
      2. 4.7.2. Solution
        1. 4.7.2.1. Straightforward
        2. 4.7.2.2. Faster
        3. 4.7.2.3. Similar but with user function
        4. 4.7.2.4. Faster but different
        5. 4.7.2.5. Faster and even more different
      3. 4.7.3. Discussion
      4. 4.7.4. See Also
    9. 4.8. Finding Elements in One Array but Not Another
      1. 4.8.1. Problem
      2. 4.8.2. Solution
        1. 4.8.2.1. Straightforward implementation
        2. 4.8.2.2. More idiomatic version
        3. 4.8.2.3. Loopless version
      3. 4.8.3. Discussion
      4. 4.8.4. See Also
    10. 4.9. Computing Union, Intersection, or Difference of Unique Lists
      1. 4.9.1. Problem
      2. 4.9.2. Solution
        1. 4.9.2.1. Simple solution for union and intersection
        2. 4.9.2.2. More idiomatic version
        3. 4.9.2.3. Union, intersection, and symmetric difference
        4. 4.9.2.4. Indirect solution
      3. 4.9.3. Discussion
      4. 4.9.4. See Also
    11. 4.10. Appending One Array to Another
      1. 4.10.1. Problem
      2. 4.10.2. Solution
      3. 4.10.3. Discussion
      4. 4.10.4. See Also
    12. 4.11. Reversing an Array
      1. 4.11.1. Problem
      2. 4.11.2. Solution
      3. 4.11.3. Discussion
      4. 4.11.4. See Also
    13. 4.12. Processing Multiple Elements of an Array
      1. 4.12.1. Problem
      2. 4.12.2. Solution
      3. 4.12.3. Discussion
      4. 4.12.4. See Also
    14. 4.13. Finding the First List Element That Passes a Test
      1. 4.13.1. Problem
      2. 4.13.2. Solution
      3. 4.13.3. Discussion
      4. 4.13.4. See Also
    15. 4.14. Finding All Elements in an Array Matching Certain Criteria
      1. 4.14.1. Problem
      2. 4.14.2. Solution
      3. 4.14.3. Discussion
      4. 4.14.4. See Also
    16. 4.15. Sorting an Array Numerically
      1. 4.15.1. Problem
      2. 4.15.2. Solution
      3. 4.15.3. Discussion
      4. 4.15.4. See Also
    17. 4.16. Sorting a List by Computable Field
      1. 4.16.1. Problem
      2. 4.16.2. Solution
      3. 4.16.3. Discussion
      4. 4.16.4. See Also
    18. 4.17. Implementing a Circular List
      1. 4.17.1. Problem
      2. 4.17.2. Solution
      3. 4.17.3. Procedure
      4. 4.17.4. Discussion
      5. 4.17.5. See Also
    19. 4.18. Randomizing an Array
      1. 4.18.1. Problem
      2. 4.18.2. Solution
      3. 4.18.3. Discussion
      4. 4.18.4. See Also
    20. 4.19. Program: words
      1. 4.19.1. See Also
    21. 4.20. Program: permute
      1. 4.20.1. See Also
  9. 5. Hashes
    1. Introduction
      1. See Also
    2. 5.1. Adding an Element to a Hash
      1. 5.1.1. Problem
      2. 5.1.2. Solution
      3. 5.1.3. Discussion
      4. 5.1.4. See Also
    3. 5.2. Testing for the Presence of a Key in a Hash
      1. 5.2.1. Problem
      2. 5.2.2. Solution
      3. 5.2.3. Discussion
      4. 5.2.4. See Also
    4. 5.3. Creating a Hash with Immutable Keys or Values
      1. 5.3.1. Problem
      2. 5.3.2. Solution
      3. 5.3.3. Discussion
      4. 5.3.4. See Also
    5. 5.4. Deleting from a Hash
      1. 5.4.1. Problem
      2. 5.4.2. Solution
      3. 5.4.3. Discussion
      4. 5.4.4. See Also
    6. 5.5. Traversing a Hash
      1. 5.5.1. Problem
      2. 5.5.2. Solution
      3. 5.5.3. Discussion
      4. 5.5.4. See Also
    7. 5.6. Printing a Hash
      1. 5.6.1. Problem
      2. 5.6.2. Solution
      3. 5.6.3. Discussion
      4. 5.6.4. See Also
    8. 5.7. Retrieving from a Hash in Insertion Order
      1. 5.7.1. Problem
      2. 5.7.2. Solution
      3. 5.7.3. Discussion
      4. 5.7.4. See Also
    9. 5.8. Hashes with Multiple Values per Key
      1. 5.8.1. Problem
      2. 5.8.2. Solution
      3. 5.8.3. Discussion
      4. 5.8.4. See Also
    10. 5.9. Inverting a Hash
      1. 5.9.1. Problem
      2. 5.9.2. Solution
      3. 5.9.3. Discussion
      4. 5.9.4. See Also
    11. 5.10. Sorting a Hash
      1. 5.10.1. Problem
      2. 5.10.2. Solution
      3. 5.10.3. Discussion
      4. 5.10.4. See Also
    12. 5.11. Merging Hashes
      1. 5.11.1. Problem
      2. 5.11.2. Solution
      3. 5.11.3. Discussion
      4. 5.11.4. See Also
    13. 5.12. Finding Common or Different Keys in Two Hashes
      1. 5.12.1. Problem
      2. 5.12.2. Solution
        1. 5.12.2.1. Find common keys
        2. 5.12.2.2. Find keys from one hash that aren't in both
      3. 5.12.3. Discussion
      4. 5.12.4. See Also
    14. 5.13. Hashing References
      1. 5.13.1. Problem
      2. 5.13.2. Solution
      3. 5.13.3. Discussion
      4. 5.13.4. See Also
    15. 5.14. Presizing a Hash
      1. 5.14.1. Problem
      2. 5.14.2. Solution
      3. 5.14.3. Discussion
      4. 5.14.4. See Also
    16. 5.15. Finding the Most Common Anything
      1. 5.15.1. Problem
      2. 5.15.2. Solution
      3. 5.15.3. Discussion
      4. 5.15.4. See Also
    17. 5.16. Representing Relationships Between Data
      1. 5.16.1. Problem
      2. 5.16.2. Solution
      3. 5.16.3. Discussion
      4. 5.16.4. See Also
    18. 5.17. Program: dutree
  10. 6. Pattern Matching
    1. Introduction
      1. The Tricky Bits
      2. Pattern-Matching Modifiers
      3. Special Variables
    2. 6.1. Copying and Substituting Simultaneously
      1. 6.1.1. Problem
      2. 6.1.2. Solution
      3. 6.1.3. Discussion
      4. 6.1.4. See Also
    3. 6.2. Matching Letters
      1. 6.2.1. Problem
      2. 6.2.2. Solution
      3. 6.2.3. Discussion
      4. 6.2.4. See Also
    4. 6.3. Matching Words
      1. 6.3.1. Problem
      2. 6.3.2. Solution
      3. 6.3.3. Discussion
      4. 6.3.4. See Also
    5. 6.4. Commenting Regular Expressions
      1. 6.4.1. Problem
      2. 6.4.2. Solution
      3. 6.4.3. Discussion
      4. 6.4.4. See Also
    6. 6.5. Finding the Nth Occurrence of a Match
      1. 6.5.1. Problem
      2. 6.5.2. Solution
      3. 6.5.3. Discussion
      4. 6.5.4. See Also
    7. 6.6. Matching Within Multiple Lines
      1. 6.6.1. Problem
      2. 6.6.2. Solution
      3. 6.6.3. Discussion
      4. 6.6.4. See Also
    8. 6.7. Reading Records with a Separator
      1. 6.7.1. Problem
      2. 6.7.2. Solution
      3. 6.7.3. Discussion
      4. 6.7.4. See Also
    9. 6.8. Extracting a Range of Lines
      1. 6.8.1. Problem
      2. 6.8.2. Solution
      3. 6.8.3. Discussion
      4. 6.8.4. See Also
    10. 6.9. Matching Shell Globs as Regular Expressions
      1. 6.9.1. Problem
      2. 6.9.2. Solution
      3. 6.9.3. Discussion
      4. 6.9.4. See Also
    11. 6.10. Speeding Up Interpolated Matches
      1. 6.10.1. Problem
      2. 6.10.2. Solution
      3. 6.10.3. Discussion
      4. 6.10.4. See Also
    12. 6.11. Testing for a Valid Pattern
      1. 6.11.1. Problem
      2. 6.11.2. Solution
      3. 6.11.3. Discussion
      4. 6.11.4. See Also
    13. 6.12. Honoring Locale Settings in Regular Expressions
      1. 6.12.1. Problem
      2. 6.12.2. Solution
      3. 6.12.3. Discussion
      4. 6.12.4. See Also
    14. 6.13. Approximate Matching
      1. 6.13.1. Problem
      2. 6.13.2. Solution
      3. 6.13.3. Discussion
      4. 6.13.4. See Also
    15. 6.14. Matching from Where the Last Pattern Left Off
      1. 6.14.1. Problem
      2. 6.14.2. Solution
      3. 6.14.3. Discussion
      4. 6.14.4. See Also
    16. 6.15. Greedy and Non-Greedy Matches
      1. 6.15.1. Problem
      2. 6.15.2. Solution
      3. 6.15.3. Discussion
      4. 6.15.4. See Also
    17. 6.16. Detecting Doubled Words
      1. 6.16.1. Problem
      2. 6.16.2. Solution
      3. 6.16.3. Discussion
      4. 6.16.4. See Also
    18. 6.17. Matching Nested Patterns
      1. 6.17.1. Problem
      2. 6.17.2. Solution
      3. 6.17.3. Discussion
      4. 6.17.4. See Also
    19. 6.18. Expressing AND, OR, and NOT in a Single Pattern
      1. 6.18.1. Problem
      2. 6.18.2. Solution
      3. 6.18.3. Discussion
      4. 6.18.4. See Also
    20. 6.19. Matching a Valid Mail Address
      1. 6.19.1. Problem
      2. 6.19.2. Solution
      3. 6.19.3. Discussion
      4. 6.19.4. See Also
    21. 6.20. Matching Abbreviations
      1. 6.20.1. Problem
      2. 6.20.2. Solution
      3. 6.20.3. Discussion
      4. 6.20.4. See Also
    22. 6.21. Program: urlify
    23. 6.22. Program: tcgrep
    24. 6.23. Regular Expression Grab Bag
  11. 7. File Access
    1. Introduction
      1. Getting a Handle on the File
      2. Standard Filehandles
      3. I/O Operations
    2. 7.1. Opening a File
      1. 7.1.1. Problem
      2. 7.1.2. Solution
      3. 7.1.3. Discussion
      4. 7.1.4. See Also
    3. 7.2. Opening Files with Unusual Filenames
      1. 7.2.1. Problem
      2. 7.2.2. Solution
      3. 7.2.3. Discussion
      4. 7.2.4. See Also
    4. 7.3. Expanding Tildes in Filenames
      1. 7.3.1. Problem
      2. 7.3.2. Solution
      3. 7.3.3. Discussion
      4. 7.3.4. See Also
    5. 7.4. Making Perl Report Filenames in Error Messages
      1. 7.4.1. Problem
      2. 7.4.2. Solution
      3. 7.4.3. Discussion
      4. 7.4.4. See Also
    6. 7.5. Storing Filehandles into Variables
      1. 7.5.1. Problem
      2. 7.5.2. Solution
      3. 7.5.3. Discussion
      4. 7.5.4. See Also
    7. 7.6. Writing a Subroutine That Takes Filehandles as Built-ins Do
      1. 7.6.1. Problem
      2. 7.6.2. Solution
      3. 7.6.3. Discussion
      4. 7.6.4. See Also
    8. 7.7. Caching Open Output Filehandles
      1. 7.7.1. Problem
      2. 7.7.2. Solution
      3. 7.7.3. Discussion
      4. 7.7.4. See Also
    9. 7.8. Printing to Many Filehandles Simultaneously
      1. 7.8.1. Problem
      2. 7.8.2. Solution
      3. 7.8.3. Discussion
      4. 7.8.4. See Also
    10. 7.9. Opening and Closing File Descriptors by Number
      1. 7.9.1. Problem
      2. 7.9.2. Solution
      3. 7.9.3. Discussion
      4. 7.9.4. See Also
    11. 7.10. Copying Filehandles
      1. 7.10.1. Problem
      2. 7.10.2. Solution
      3. 7.10.3. Discussion
      4. 7.10.4. See Also
    12. 7.11. Creating Temporary Files
      1. 7.11.1. Problem
      2. 7.11.2. Solution
      3. 7.11.3. Discussion
      4. 7.11.4. See Also
    13. 7.12. Storing a File Inside Your Program Text
      1. 7.12.1. Problem
      2. 7.12.2. Solution
      3. 7.12.3. Discussion
      4. 7.12.4. See Also
    14. 7.13. Storing Multiple Files in the DATA Area
      1. 7.13.1. Problem
      2. 7.13.2. Solution
      3. 7.13.3. Discussion
      4. 7.13.4. See Also
    15. 7.14. Writing a Unix-Style Filter Program
      1. 7.14.1. Problem
      2. 7.14.2. Solution
      3. 7.14.3. Discussion
        1. 7.14.3.1. Behavior
        2. 7.14.3.2. Command-line options
      4. 7.14.4. See Also
    16. 7.15. Modifying a File in Place with a Temporary File
      1. 7.15.1. Problem
      2. 7.15.2. Solution
      3. 7.15.3. Discussion
      4. 7.15.4. See Also
    17. 7.16. Modifying a File in Place with the -i Switch
      1. 7.16.1. Problem
      2. 7.16.2. Solution
      3. 7.16.3. Discussion
      4. 7.16.4. See Also
    18. 7.17. Modifying a File in Place Without a Temporary File
      1. 7.17.1. Problem
      2. 7.17.2. Solution
      3. 7.17.3. Discussion
      4. 7.17.4. See Also
    19. 7.18. Locking a File
      1. 7.18.1. Problem
      2. 7.18.2. Solution
      3. 7.18.3. Discussion
      4. 7.18.4. See Also
    20. 7.19. Flushing Output
      1. 7.19.1. Problem
      2. 7.19.2. Solution
      3. 7.19.3. Discussion
      4. 7.19.4. See Also
    21. 7.20. Doing Non-Blocking I/O
      1. 7.20.1. Problem
      2. 7.20.2. Solution
      3. 7.20.3. Discussion
      4. 7.20.4. See Also
    22. 7.21. Determining the Number of Unread Bytes
      1. 7.21.1. Problem
      2. 7.21.2. Solution
      3. 7.21.3. Discussion
      4. 7.21.4. See Also
    23. 7.22. Reading from Many Filehandles Without Blocking
      1. 7.22.1. Problem
      2. 7.22.2. Solution
      3. 7.22.3. Discussion
      4. 7.22.4. See Also
    24. 7.23. Reading an Entire Line Without Blocking
      1. 7.23.1. Problem
      2. 7.23.2. Solution
      3. 7.23.3. Discussion
      4. 7.23.4. See Also
    25. 7.24. Program: netlock
    26. 7.25. Program: lockarea
  12. 8. File Contents
    1. Introduction
      1. Basic Operations
      2. Newlines
      3. I/O Layers
      4. Advanced Operations
    2. 8.1. Reading Lines with Continuation Characters
      1. 8.1.1. Problem
      2. 8.1.2. Solution
      3. 8.1.3. Discussion
      4. 8.1.4. See Also
    3. 8.2. Counting Lines (or Paragraphs or Records) in a File
      1. 8.2.1. Problem
      2. 8.2.2. Solution
      3. 8.2.3. Discussion
      4. 8.2.4. See Also
    4. 8.3. Processing Every Word in a File
      1. 8.3.1. Problem
      2. 8.3.2. Solution
      3. 8.3.3. Discussion
      4. 8.3.4. See Also
    5. 8.4. Reading a File Backward by Line or Paragraph
      1. 8.4.1. Problem
      2. 8.4.2. Solution
      3. 8.4.3. Discussion
      4. 8.4.4. See Also
    6. 8.5. Trailing a Growing File
      1. 8.5.1. Problem
      2. 8.5.2. Solution
      3. 8.5.3. Discussion
      4. 8.5.4. See Also
    7. 8.6. Picking a Random Line from a File
      1. 8.6.1. Problem
      2. 8.6.2. Solution
      3. 8.6.3. Discussion
      4. 8.6.4. See Also
    8. 8.7. Randomizing All Lines
      1. 8.7.1. Problem
      2. 8.7.2. Solution
      3. 8.7.3. Discussion
      4. 8.7.4. See Also
    9. 8.8. Reading a Particular Line in a File
      1. 8.8.1. Problem
      2. 8.8.2. Solution
      3. 8.8.3. Discussion
      4. 8.8.4. See Also
    10. 8.9. Processing Variable-Length Text Fields
      1. 8.9.1. Problem
      2. 8.9.2. Solution
      3. 8.9.3. Discussion
      4. 8.9.4. See Also
    11. 8.10. Removing the Last Line of a File
      1. 8.10.1. Problem
      2. 8.10.2. Solution
      3. 8.10.3. Discussion
      4. 8.10.4. See Also
    12. 8.11. Processing Binary Files
      1. 8.11.1. Problem
      2. 8.11.2. Solution
      3. 8.11.3. Discussion
      4. 8.11.4. See Also
    13. 8.12. Using Random-Access I/O
      1. 8.12.1. Problem
      2. 8.12.2. Solution
      3. 8.12.3. Discussion
      4. 8.12.4. See Also
    14. 8.13. Updating a Random-Access File
      1. 8.13.1. Problem
      2. 8.13.2. Solution
      3. 8.13.3. Discussion
      4. 8.13.4. See Also
    15. 8.14. Reading a String from a Binary File
      1. 8.14.1. Problem
      2. 8.14.2. Solution
      3. 8.14.3. Discussion
      4. 8.14.4. See Also
    16. 8.15. Reading Fixed-Length Records
      1. 8.15.1. Problem
      2. 8.15.2. Solution
      3. 8.15.3. Discussion
      4. 8.15.4. See Also
    17. 8.16. Reading Configuration Files
      1. 8.16.1. Problem
      2. 8.16.2. Solution
      3. 8.16.3. Discussion
      4. 8.16.4. See Also
    18. 8.17. Testing a File for Trustworthiness
      1. 8.17.1. Problem
      2. 8.17.2. Solution
      3. 8.17.3. Discussion
      4. 8.17.4. See Also
    19. 8.18. Treating a File as an Array
      1. 8.18.1. Problem
      2. 8.18.2. Solution
      3. 8.18.3. Discussion
      4. 8.18.4. See Also
    20. 8.19. Setting the Default I/O Layers
      1. 8.19.1. Problem
      2. 8.19.2. Solution
      3. 8.19.3. Discussion
      4. 8.19.4. See Also
    21. 8.20. Reading or Writing Unicode from a Filehandle
      1. 8.20.1. Problem
      2. 8.20.2. Solution
      3. 8.20.3. Discussion
      4. 8.20.4. See Also
    22. 8.21. Converting Microsoft Text Files into Unicode
      1. 8.21.1. Problem
      2. 8.21.2. Solution
      3. 8.21.3. Discussion
      4. 8.21.4. See Also
    23. 8.22. Comparing the Contents of Two Files
      1. 8.22.1. Problem
      2. 8.22.2. Solution
      3. 8.22.3. Discussion
      4. 8.22.4. See Also
    24. 8.23. Pretending a String Is a File
      1. 8.23.1. Problem
      2. 8.23.2. Solution
      3. 8.23.3. Discussion
      4. 8.23.4. See Also
    25. 8.24. Program: tailwtmp
    26. 8.25. Program: tctee
    27. 8.26. Program: laston
    28. 8.27. Program: Flat File Indexes
  13. 9. Directories
    1. Introduction
      1. Executive Summary
    2. 9.1. Getting and Setting Timestamps
      1. 9.1.1. Problem
      2. 9.1.2. Solution
      3. 9.1.3. Discussion
      4. 9.1.4. See Also
    3. 9.2. Deleting a File
      1. 9.2.1. Problem
      2. 9.2.2. Solution
      3. 9.2.3. Discussion
      4. 9.2.4. See Also
    4. 9.3. Copying or Moving a File
      1. 9.3.1. Problem
      2. 9.3.2. Solution
      3. 9.3.3. Discussion
      4. 9.3.4. See Also
    5. 9.4. Recognizing Two Names for the Same File
      1. 9.4.1. Problem
      2. 9.4.2. Solution
      3. 9.4.3. Discussion
      4. 9.4.4. See Also
    6. 9.5. Processing All Files in a Directory
      1. 9.5.1. Problem
      2. 9.5.2. Solution
      3. 9.5.3. Discussion
      4. 9.5.4. See Also
    7. 9.6. Globbing, or Getting a List of Filenames Matching a Pattern
      1. 9.6.1. Problem
      2. 9.6.2. Solution
      3. 9.6.3. Discussion
      4. 9.6.4. See Also
    8. 9.7. Processing All Files in a Directory Recursively
      1. 9.7.1. Problem
      2. 9.7.2. Solution
      3. 9.7.3. Discussion
      4. 9.7.4. See Also
    9. 9.8. Removing a Directory and Its Contents
      1. 9.8.1. Problem
      2. 9.8.2. Solution
      3. 9.8.3. Discussion
      4. 9.8.4. See Also
    10. 9.9. Renaming Files
      1. 9.9.1. Problem
      2. 9.9.2. Solution
      3. 9.9.3. Discussion
      4. 9.9.4. See Also
    11. 9.10. Splitting a Filename into Its Component Parts
      1. 9.10.1. Problem
      2. 9.10.2. Solution
      3. 9.10.3. Discussion
      4. 9.10.4. See Also
    12. 9.11. Working with Symbolic File Permissions Instead of Octal Values
      1. 9.11.1. Problem
      2. 9.11.2. Solution
      3. 9.11.3. Discussion
      4. 9.11.4. See Also
    13. 9.12. Program: symirror
    14. 9.13. Program: lst
  14. 10. Subroutines
    1. Introduction
    2. 10.1. Accessing Subroutine Arguments
      1. 10.1.1. Problem
      2. 10.1.2. Solution
      3. 10.1.3. Discussion
      4. 10.1.4. See Also
    3. 10.2. Making Variables Private to a Function
      1. 10.2.1. Problem
      2. 10.2.2. Solution
      3. 10.2.3. Discussion
      4. 10.2.4. See Also
    4. 10.3. Creating Persistent Private Variables
      1. 10.3.1. Problem
      2. 10.3.2. Solution
      3. 10.3.3. Discussion
      4. 10.3.4. See Also
    5. 10.4. Determining Current Function Name
      1. 10.4.1. Problem
      2. 10.4.2. Solution
      3. 10.4.3. Discussion
      4. 10.4.4. See Also
    6. 10.5. Passing Arrays and Hashes by Reference
      1. 10.5.1. Problem
      2. 10.5.2. Solution
      3. 10.5.3. Discussion
      4. 10.5.4. See Also
    7. 10.6. Detecting Return Context
      1. 10.6.1. Problem
      2. 10.6.2. Solution
      3. 10.6.3. Discussion
      4. 10.6.4. See Also
    8. 10.7. Passing by Named Parameter
      1. 10.7.1. Problem
      2. 10.7.2. Solution
      3. 10.7.3. Discussion
      4. 10.7.4. See Also
    9. 10.8. Skipping Selected Return Values
      1. 10.8.1. Problem
      2. 10.8.2. Solution
      3. 10.8.3. Discussion
      4. 10.8.4. See Also
    10. 10.9. Returning More Than One Array or Hash
      1. 10.9.1. Problem
      2. 10.9.2. Solution
      3. 10.9.3. Discussion
      4. 10.9.4. See Also
    11. 10.10. Returning Failure
      1. 10.10.1. Problem
      2. 10.10.2. Solution
      3. 10.10.3. Discussion
      4. 10.10.4. See Also
    12. 10.11. Prototyping Functions
      1. 10.11.1. Problem
      2. 10.11.2. Solution
      3. 10.11.3. Discussion
        1. 10.11.3.1. Omitting parentheses
        2. 10.11.3.2. Mimicking built-ins
      4. 10.11.4. See Also
    13. 10.12. Handling Exceptions
      1. 10.12.1. Problem
      2. 10.12.2. Solution
      3. 10.12.3. Discussion
      4. 10.12.4. See Also
    14. 10.13. Saving Global Values
      1. 10.13.1. Problem
      2. 10.13.2. Solution
      3. 10.13.3. Discussion
        1. 10.13.3.1. Using local( ) for temporary values for globals
        2. 10.13.3.2. Using local( ) for local handles
        3. 10.13.3.3. Using local( ) on parts of aggregates
      4. 10.13.4. See Also
    15. 10.14. Redefining a Function
      1. 10.14.1. Problem
      2. 10.14.2. Solution
      3. 10.14.3. Discussion
      4. 10.14.4. See Also
    16. 10.15. Trapping Undefined Function Calls with AUTOLOAD
      1. 10.15.1. Problem
      2. 10.15.2. Solution
      3. 10.15.3. Discussion
      4. 10.15.4. See Also
    17. 10.16. Nesting Subroutines
      1. 10.16.1. Problem
      2. 10.16.2. Solution
      3. 10.16.3. Discussion
      4. 10.16.4. See Also
    18. 10.17. Writing a Switch Statement
      1. 10.17.1. Problem
      2. 10.17.2. Solution
      3. 10.17.3. Discussion
      4. 10.17.4. See Also
    19. 10.18. Program: Sorting Your Mail
      1. 10.18.1. See Also
  15. 11. References and Records
    1. Introduction
      1. References
      2. Anonymous Data
      3. Records
      4. See Also
    2. 11.1. Taking References to Arrays
      1. 11.1.1. Problem
      2. 11.1.2. Solution
      3. 11.1.3. Discussion
      4. 11.1.4. See Also
    3. 11.2. Making Hashes of Arrays
      1. 11.2.1. Problem
      2. 11.2.2. Solution
      3. 11.2.3. Discussion
      4. 11.2.4. See Also
    4. 11.3. Taking References to Hashes
      1. 11.3.1. Problem
      2. 11.3.2. Solution
      3. 11.3.3. Discussion
      4. 11.3.4. See Also
    5. 11.4. Taking References to Functions
      1. 11.4.1. Problem
      2. 11.4.2. Solution
      3. 11.4.3. Discussion
      4. 11.4.4. See Also
    6. 11.5. Taking References to Scalars
      1. 11.5.1. Problem
      2. 11.5.2. Solution
      3. 11.5.3. Discussion
      4. 11.5.4. See Also
    7. 11.6. Creating Arrays of Scalar References
      1. 11.6.1. Problem
      2. 11.6.2. Solution
      3. 11.6.3. Discussion
      4. 11.6.4. See Also
    8. 11.7. Using Closures Instead of Objects
      1. 11.7.1. Problem
      2. 11.7.2. Solution
      3. 11.7.3. Discussion
      4. 11.7.4. See Also
    9. 11.8. Creating References to Methods
      1. 11.8.1. Problem
      2. 11.8.2. Solution
      3. 11.8.3. Discussion
      4. 11.8.4. See Also
    10. 11.9. Constructing Records
      1. 11.9.1. Problem
      2. 11.9.2. Solution
      3. 11.9.3. Discussion
      4. 11.9.4. See Also
    11. 11.10. Reading and Writing Hash Records to Text Files
      1. 11.10.1. Problem
      2. 11.10.2. Solution
      3. 11.10.3. Discussion
      4. 11.10.4. See Also
    12. 11.11. Printing Data Structures
      1. 11.11.1. Problem
      2. 11.11.2. Solution
      3. 11.11.3. Discussion
      4. 11.11.4. See Also
    13. 11.12. Copying Data Structures
      1. 11.12.1. Problem
      2. 11.12.2. Solution
      3. 11.12.3. Discussion
      4. 11.12.4. See Also
    14. 11.13. Storing Data Structures to Disk
      1. 11.13.1. Problem
      2. 11.13.2. Solution
      3. 11.13.3. Discussion
      4. 11.13.4. See Also
    15. 11.14. Transparently Persistent Data Structures
      1. 11.14.1. Problem
      2. 11.14.2. Solution
      3. 11.14.3. Discussion
      4. 11.14.4. See Also
    16. 11.15. Coping with Circular Data Structures Using Weak References
      1. 11.15.1. Problem
      2. 11.15.2. Solution
      3. 11.15.3. Description
      4. 11.15.4. See Also
    17. 11.16. Program: Outlines
    18. 11.17. Program: Binary Trees
  16. 12. Packages, Libraries, and Modules
    1. Introduction
      1. Modules
      2. Import/Export Regulations
      3. Other Kinds of Library Files
      4. Not Reinventing the Wheel
      5. See Also
    2. 12.1. Defining a Module's Interface
      1. 12.1.1. Problem
      2. 12.1.2. Solution
      3. 12.1.3. Discussion
      4. 12.1.4. See Also
    3. 12.2. Trapping Errors in require or use
      1. 12.2.1. Problem
      2. 12.2.2. Solution
      3. 12.2.3. Discussion
      4. 12.2.4. See Also
    4. 12.3. Delaying use Until Runtime
      1. 12.3.1. Problem
      2. 12.3.2. Solution
      3. 12.3.3. Discussion
      4. 12.3.4. See Also
    5. 12.4. Making Variables Private to a Module
      1. 12.4.1. Problem
      2. 12.4.2. Solution
      3. 12.4.3. Discussion
      4. 12.4.4. See Also
    6. 12.5. Making Functions Private to a Module
      1. 12.5.1. Problem
      2. 12.5.2. Solution
      3. 12.5.3. Discussion
      4. 12.5.4. See Also
    7. 12.6. Determining the Caller's Package
      1. 12.6.1. Problem
      2. 12.6.2. Solution
      3. 12.6.3. Discussion
      4. 12.6.4. See Also
    8. 12.7. Automating Module Cleanup
      1. 12.7.1. Problem
      2. 12.7.2. Solution
      3. 12.7.3. Discussion
      4. 12.7.4. See Also
    9. 12.8. Keeping Your Own Module Directory
      1. 12.8.1. Problem
      2. 12.8.2. Solution
      3. 12.8.3. Discussion
      4. 12.8.4. See Also
    10. 12.9. Preparing a Module for Distribution
      1. 12.9.1. Problem
      2. 12.9.2. Solution
      3. 12.9.3. Discussion
      4. 12.9.4. See Also
    11. 12.10. Speeding Module Loading with SelfLoader
      1. 12.10.1. Problem
      2. 12.10.2. Solution
      3. 12.10.3. Discussion
      4. 12.10.4. See Also
    12. 12.11. Speeding Up Module Loading with Autoloader
      1. 12.11.1. Problem
      2. 12.11.2. Solution
      3. 12.11.3. Discussion
      4. 12.11.4. See Also
    13. 12.12. Overriding Built-in Functions
      1. 12.12.1. Problem
      2. 12.12.2. Solution
      3. 12.12.3. Discussion
      4. 12.12.4. See Also
    14. 12.13. Overriding a Built-in Function in All Packages
      1. 12.13.1. Problem
      2. 12.13.2. Solution
      3. 12.13.3. Discussion
      4. 12.13.4. See Also
    15. 12.14. Reporting Errors and Warnings Like Built-ins
      1. 12.14.1. Problem
      2. 12.14.2. Solution
      3. 12.14.3. Discussion
      4. 12.14.4. See Also
    16. 12.15. Customizing Warnings
      1. 12.15.1. Problem
      2. 12.15.2. Solution
      3. 12.15.3. Discussion
      4. 12.15.4. See Also
    17. 12.16. Referring to Packages Indirectly
      1. 12.16.1. Problem
      2. 12.16.2. Solution
      3. 12.16.3. Discussion
      4. 12.16.4. See Also
    18. 12.17. Using h2ph to Translate C #include Files
      1. 12.17.1. Problem
      2. 12.17.2. Solution
      3. 12.17.3. Discussion
      4. 12.17.4. See Also
    19. 12.18. Using h2xs to Make a Module with C Code
      1. 12.18.1. Problem
      2. 12.18.2. Solution
      3. 12.18.3. Discussion
      4. 12.18.4. See Also
    20. 12.19. Writing Extensions in C with Inline::C
      1. 12.19.1. Problem
      2. 12.19.2. Solution
      3. 12.19.3. Discussion
      4. 12.19.4. See Also
    21. 12.20. Documenting Your Module with Pod
      1. 12.20.1. Problem
      2. 12.20.2. Solution
      3. 12.20.3. Discussion
      4. 12.20.4. See Also
    22. 12.21. Building and Installing a CPAN Module
      1. 12.21.1. Problem
      2. 12.21.2. Solution
      3. 12.21.3. Discussion
      4. 12.21.4. See Also
    23. 12.22. Example: Module Template
    24. 12.23. Program: Finding Versions and Descriptions of Installed Modules
  17. 13. Classes, Objects, and Ties
    1. Introduction
      1. Under the Hood
      2. Methods
      3. Inheritance
      4. A Warning on Indirect Object Notation
      5. Some Notes on Object Terminology
      6. Philosophical Aside
      7. See Also
    2. 13.1. Constructing an Object
      1. 13.1.1. Problem
      2. 13.1.2. Solution
      3. 13.1.3. Discussion
      4. 13.1.4. See Also
    3. 13.2. Destroying an Object
      1. 13.2.1. Problem
      2. 13.2.2. Solution
      3. 13.2.3. Discussion
      4. 13.2.4. See Also
    4. 13.3. Managing Instance Data
      1. 13.3.1. Problem
      2. 13.3.2. Solution
      3. 13.3.3. Discussion
      4. 13.3.4. See Also
    5. 13.4. Managing Class Data
      1. 13.4.1. Problem
      2. 13.4.2. Solution
      3. 13.4.3. Discussion
      4. 13.4.4. See Also
    6. 13.5. Using Classes as Structs
      1. 13.5.1. Problem
      2. 13.5.2. Solution
      3. 13.5.3. Discussion
      4. 13.5.4. See Also
    7. 13.6. Cloning Constructors
      1. 13.6.1. Problem
      2. 13.6.2. Solution
      3. 13.6.3. Discussion
      4. 13.6.4. See Also
    8. 13.7. Copy Constructors
      1. 13.7.1. Problem
      2. 13.7.2. Solution
      3. 13.7.3. Discussion
      4. 13.7.4. See Also
    9. 13.8. Invoking Methods Indirectly
      1. 13.8.1. Problem
      2. 13.8.2. Solution
      3. 13.8.3. Discussion
      4. 13.8.4. See Also
    10. 13.9. Determining Subclass Membership
      1. 13.9.1. Problem
      2. 13.9.2. Solution
      3. 13.9.3. Discussion
      4. 13.9.4. See Also
    11. 13.10. Writing an Inheritable Class
      1. 13.10.1. Problem
      2. 13.10.2. Solution
      3. 13.10.3. Discussion
      4. 13.10.4. See Also
    12. 13.11. Accessing Overridden Methods
      1. 13.11.1. Problem
      2. 13.11.2. Solution
      3. 13.11.3. Discussion
      4. 13.11.4. See Also
    13. 13.12. Generating Attribute Methods Using AUTOLOAD
      1. 13.12.1. Problem
      2. 13.12.2. Solution
      3. 13.12.3. Discussion
      4. 13.12.4. See Also
    14. 13.13. Coping with Circular Data Structures Using Objects
      1. 13.13.1. Problem
      2. 13.13.2. Solution
      3. 13.13.3. Discussion
      4. 13.13.4. See Also
    15. 13.14. Overloading Operators
      1. 13.14.1. Problem
      2. 13.14.2. Solution
      3. 13.14.3. Discussion
      4. 13.14.4. Example: Overloaded StrNum Class
      5. 13.14.5. Example: Overloaded FixNum Class
      6. 13.14.6. See Also
    16. 13.15. Creating Magic Variables with tie
      1. 13.15.1. Problem
      2. 13.15.2. Solution
      3. 13.15.3. Discussion
      4. 13.15.4. Tie Example: Outlaw $_
      5. 13.15.5. Tie Example: Make a Hash That Always Appends
      6. 13.15.6. Tie Example: Case-Insensitive Hash
      7. 13.15.7. Tie Example: Hash That Allows Lookups by Key or Value
      8. 13.15.8. Tie Example: Handle That Counts Access
      9. 13.15.9. Tie Example: Multiple Sink Filehandles
      10. 13.15.10. See Also
  18. 14. Database Access
    1. Introduction
    2. 14.1. Making and Using a DBM File
      1. 14.1.1. Problem
      2. 14.1.2. Solution
      3. 14.1.3. Discussion
      4. 14.1.4. See Also
    3. 14.2. Emptying a DBM File
      1. 14.2.1. Problem
      2. 14.2.2. Solution
      3. 14.2.3. Discussion
      4. 14.2.4. See Also
    4. 14.3. Converting Between DBM Files
      1. 14.3.1. Problem
      2. 14.3.2. Solution
      3. 14.3.3. Discussion
      4. 14.3.4. See Also
    5. 14.4. Merging DBM Files
      1. 14.4.1. Problem
      2. 14.4.2. Solution
      3. 14.4.3. Discussion
      4. 14.4.4. See Also
    6. 14.5. Sorting Large DBM Files
      1. 14.5.1. Problem
      2. 14.5.2. Solution
      3. 14.5.3. Description
      4. 14.5.4. See Also
    7. 14.6. Storing Complex Data in a DBM File
      1. 14.6.1. Problem
      2. 14.6.2. Solution
      3. 14.6.3. Discussion
      4. 14.6.4. See Also
    8. 14.7. Persistent Data
      1. 14.7.1. Problem
      2. 14.7.2. Solution
      3. 14.7.3. Discussion
      4. 14.7.4. See Also
    9. 14.8. Saving Query Results to Excel or CSV
      1. 14.8.1. Problem
      2. 14.8.2. Solution
      3. 14.8.3. Discussion
      4. 14.8.4. See Also
    10. 14.9. Executing an SQL Command Using DBI
      1. 14.9.1. Problem
      2. 14.9.2. Solution
      3. 14.9.3. Discussion
      4. 14.9.4. See Also
    11. 14.10. Escaping Quotes
      1. 14.10.1. Problem
      2. 14.10.2. Solution
      3. 14.10.3. Discussion
      4. 14.10.4. See Also
    12. 14.11. Dealing with Database Errors
      1. 14.11.1. Problem
      2. 14.11.2. Solution
      3. 14.11.3. Discussion
      4. 14.11.4. See Also
    13. 14.12. Repeating Queries Efficiently
      1. 14.12.1. Problem
      2. 14.12.2. Solution
      3. 14.12.3. Discussion
      4. 14.12.4. See Also
    14. 14.13. Building Queries Programmatically
      1. 14.13.1. Problem
      2. 14.13.2. Solution
      3. 14.13.3. Discussion
      4. 14.13.4. See Also
    15. 14.14. Finding the Number of Rows Returned by a Query
      1. 14.14.1. Problem
      2. 14.14.2. Solution
      3. 14.14.3. Discussion
      4. 14.14.4. See Also
    16. 14.15. Using Transactions
      1. 14.15.1. Problem
      2. 14.15.2. Solution
      3. 14.15.3. Discussion
      4. 14.15.4. See Also
    17. 14.16. Viewing Data One Page at a Time
      1. 14.16.1. Problem
      2. 14.16.2. Solution
      3. 14.16.3. Discussion
      4. 14.16.4. See Also
    18. 14.17. Querying a CSV File with SQL
      1. 14.17.1. Problem
      2. 14.17.2. Solution
      3. 14.17.3. Discussion
      4. 14.17.4. See Also
    19. 14.18. Using SQL Without a Database Server
      1. 14.18.1. Problem
      2. 14.18.2. Solution
      3. 14.18.3. Discussion
      4. 14.18.4. See Also
    20. 14.19. Program: ggh—Grep Netscape Global History
      1. 14.19.1. See Also
  19. 15. Interactivity
    1. Introduction
    2. 15.1. Parsing Program Arguments
      1. 15.1.1. Problem
      2. 15.1.2. Solution
      3. 15.1.3. Discussion
      4. 15.1.4. See Also
    3. 15.2. Testing Whether a Program Is Running Interactively
      1. 15.2.1. Problem
      2. 15.2.2. Solution
      3. 15.2.3. Discussion
      4. 15.2.4. See Also
    4. 15.3. Clearing the Screen
      1. 15.3.1. Problem
      2. 15.3.2. Solution
      3. 15.3.3. Discussion
      4. 15.3.4. See Also
    5. 15.4. Determining Terminal or Window Size
      1. 15.4.1. Problem
      2. 15.4.2. Solution
      3. 15.4.3. Discussion
      4. 15.4.4. See Also
    6. 15.5. Changing Text Color
      1. 15.5.1. Problem
      2. 15.5.2. Solution
      3. 15.5.3. Discussion
      4. 15.5.4. See Also
    7. 15.6. Reading Single Characters from the Keyboard
      1. 15.6.1. Problem
      2. 15.6.2. Solution
      3. 15.6.3. Discussion
      4. 15.6.4. See Also
    8. 15.7. Ringing the Terminal Bell
      1. 15.7.1. Problem
      2. 15.7.2. Solution
      3. 15.7.3. Discussion
      4. 15.7.4. See Also
    9. 15.8. Using POSIX termios
      1. 15.8.1. Problem
      2. 15.8.2. Solution
      3. 15.8.3. Description
      4. 15.8.4. See Also
    10. 15.9. Checking for Waiting Input
      1. 15.9.1. Problem
      2. 15.9.2. Solution
      3. 15.9.3. Discussion
      4. 15.9.4. See Also
    11. 15.10. Reading Passwords
      1. 15.10.1. Problem
      2. 15.10.2. Solution
      3. 15.10.3. Discussion
      4. 15.10.4. See Also
    12. 15.11. Editing Input
      1. 15.11.1. Problem
      2. 15.11.2. Solution
      3. 15.11.3. Discussion
      4. 15.11.4. See Also
    13. 15.12. Managing the Screen
      1. 15.12.1. Problem
      2. 15.12.2. Solution
      3. 15.12.3. Description
      4. 15.12.4. See Also
    14. 15.13. Controlling Another Program with Expect
      1. 15.13.1. Problem
      2. 15.13.2. Solution
      3. 15.13.3. Discussion
      4. 15.13.4. See Also
    15. 15.14. Creating Menus with Tk
      1. 15.14.1. Problem
      2. 15.14.2. Solution
      3. 15.14.3. Discussion
      4. 15.14.4. See Also
    16. 15.15. Creating Dialog Boxes with Tk
      1. 15.15.1. Problem
      2. 15.15.2. Solution
      3. 15.15.3. Discussion
      4. 15.15.4. See Also
    17. 15.16. Responding to Tk Resize Events
      1. 15.16.1. Problem
      2. 15.16.2. Solution
      3. 15.16.3. Discussion
      4. 15.16.4. See Also
    18. 15.17. Removing the DOS Shell Window with Windows Perl/Tk
      1. 15.17.1. Problem
      2. 15.17.2. Solution
      3. 15.17.3. Description
      4. 15.17.4. See Also
    19. 15.18. Graphing Data
      1. 15.18.1. Problem
      2. 15.18.2. Solution
      3. 15.18.3. Discussion
      4. 15.18.4. See Also
    20. 15.19. Thumbnailing Images
      1. 15.19.1. Problem
      2. 15.19.2. Solution
      3. 15.19.3. Discussion
      4. 15.19.4. See Also
    21. 15.20. Adding Text to an Image
      1. 15.20.1. Problem
      2. 15.20.2. Solution
      3. 15.20.3. Discussion
      4. 15.20.4. See Also
    22. 15.21. Program: Small termcap Program
      1. 15.21.1. Description
      2. 15.21.2. See Also
    23. 15.22. Program: tkshufflepod
    24. 15.23. Program: graphbox
  20. 16. Process Management and Communication
    1. Introduction
      1. Process Creation
      2. Signals
    2. 16.1. Gathering Output from a Program
      1. 16.1.1. Problem
      2. 16.1.2. Solution
      3. 16.1.3. Discussion
      4. 16.1.4. See Also
    3. 16.2. Running Another Program
      1. 16.2.1. Problem
      2. 16.2.2. Solution
      3. 16.2.3. Discussion
      4. 16.2.4. See Also
    4. 16.3. Replacing the Current Program with a Different One
      1. 16.3.1. Problem
      2. 16.3.2. Solution
      3. 16.3.3. Discussion
      4. 16.3.4. See Also
    5. 16.4. Reading or Writing to Another Program
      1. 16.4.1. Problem
      2. 16.4.2. Solution
      3. 16.4.3. Discussion
      4. 16.4.4. See Also
    6. 16.5. Filtering Your Own Output
      1. 16.5.1. Problem
      2. 16.5.2. Solution
      3. 16.5.3. Discussion
      4. 16.5.4. See Also
    7. 16.6. Preprocessing Input
      1. 16.6.1. Problem
      2. 16.6.2. Solution
      3. 16.6.3. Discussion
      4. 16.6.4. See Also
    8. 16.7. Reading STDERR from a Program
      1. 16.7.1. Problem
      2. 16.7.2. Solution
      3. 16.7.3. Discussion
      4. 16.7.4. See Also
    9. 16.8. Controlling Input and Output of Another Program
      1. 16.8.1. Problem
      2. 16.8.2. Solution
      3. 16.8.3. Discussion
      4. 16.8.4. See Also
    10. 16.9. Controlling the Input, Output, and Error of Another Program
      1. 16.9.1. Problem
      2. 16.9.2. Solution
      3. 16.9.3. Discussion
      4. 16.9.4. See Also
    11. 16.10. Communicating Between Related Processes
      1. 16.10.1. Problem
      2. 16.10.2. Solution
      3. 16.10.3. Discussion
      4. 16.10.4. See Also
    12. 16.11. Making a Process Look Like a File with Named Pipes
      1. 16.11.1. Problem
      2. 16.11.2. Solution
      3. 16.11.3. Discussion
      4. 16.11.4. See Also
    13. 16.12. Sharing Variables in Different Processes
      1. 16.12.1. Problem
      2. 16.12.2. Solution
      3. 16.12.3. Discussion
      4. 16.12.4. See Also
    14. 16.13. Listing Available Signals
      1. 16.13.1. Problem
      2. 16.13.2. Solution
      3. 16.13.3. Discussion
      4. 16.13.4. See Also
    15. 16.14. Sending a Signal
      1. 16.14.1. Problem
      2. 16.14.2. Solution
      3. 16.14.3. Discussion
      4. 16.14.4. See Also
    16. 16.15. Installing a Signal Handler
      1. 16.15.1. Problem
      2. 16.15.2. Solution
      3. 16.15.3. Discussion
      4. 16.15.4. See Also
    17. 16.16. Temporarily Overriding a Signal Handler
      1. 16.16.1. Problem
      2. 16.16.2. Solution
      3. 16.16.3. Discussion
      4. 16.16.4. See Also
    18. 16.17. Writing a Signal Handler
      1. 16.17.1. Problem
      2. 16.17.2. Solution
      3. 16.17.3. Discussion
      4. 16.17.4. See Also
    19. 16.18. Catching Ctrl-C
      1. 16.18.1. Problem
      2. 16.18.2. Solution
      3. 16.18.3. Discussion
      4. 16.18.4. See Also
    20. 16.19. Avoiding Zombie Processes
      1. 16.19.1. Problem
      2. 16.19.2. Solution
      3. 16.19.3. Discussion
      4. 16.19.4. See Also
    21. 16.20. Blocking Signals
      1. 16.20.1. Problem
      2. 16.20.2. Solution
      3. 16.20.3. Discussion
      4. 16.20.4. See Also
    22. 16.21. Timing Out an Operation
      1. 16.21.1. Problem
      2. 16.21.2. Solution
      3. 16.21.3. Discussion
      4. 16.21.4. See Also
    23. 16.22. Turning Signals into Fatal Errors
      1. 16.22.1. Problem
      2. 16.22.2. Solution
      3. 16.22.3. Discussion
      4. 16.22.4. See Also
    24. 16.23. Program: sigrand
  21. 17. Sockets
    1. Introduction
    2. 17.1. Writing a TCP Client
      1. 17.1.1. Problem
      2. 17.1.2. Solution
      3. 17.1.3. Discussion
      4. 17.1.4. See Also
    3. 17.2. Writing a TCP Server
      1. 17.2.1. Problem
      2. 17.2.2. Solution
      3. 17.2.3. Discussion
      4. 17.2.4. See Also
    4. 17.3. Communicating over TCP
      1. 17.3.1. Problem
      2. 17.3.2. Solution
      3. 17.3.3. Discussion
      4. 17.3.4. See Also
    5. 17.4. Setting Up a UDP Client
      1. 17.4.1. Problem
      2. 17.4.2. Solution
      3. 17.4.3. Discussion
      4. 17.4.4. See Also
    6. 17.5. Setting Up a UDP Server
      1. 17.5.1. Problem
      2. 17.5.2. Solution
      3. 17.5.3. Discussion
      4. 17.5.4. See Also
    7. 17.6. Using Unix Domain Sockets
      1. 17.6.1. Problem
      2. 17.6.2. Solution
      3. 17.6.3. Discussion
      4. 17.6.4. See Also
    8. 17.7. Identifying the Other End of a Socket
      1. 17.7.1. Problem
      2. 17.7.2. Solution
      3. 17.7.3. Discussion
      4. 17.7.4. See Also
    9. 17.8. Finding Your Own Name and Address
      1. 17.8.1. Problem
      2. 17.8.2. Solution
      3. 17.8.3. Discussion
      4. 17.8.4. See Also
    10. 17.9. Closing a Socket After Forking
      1. 17.9.1. Problem
      2. 17.9.2. Solution
      3. 17.9.3. Discussion
      4. 17.9.4. See Also
    11. 17.10. Writing Bidirectional Clients
      1. 17.10.1. Problem
      2. 17.10.2. Solution
      3. 17.10.3. Discussion
      4. 17.10.4. See Also
    12. 17.11. Forking Servers
      1. 17.11.1. Problem
      2. 17.11.2. Solution
      3. 17.11.3. Discussion
      4. 17.11.4. See Also
    13. 17.12. Pre-Forking Servers
      1. 17.12.1. Problem
      2. 17.12.2. Solution
      3. 17.12.3. Discussion
      4. 17.12.4. See Also
    14. 17.13. Non-Forking Servers
      1. 17.13.1. Problem
      2. 17.13.2. Solution
      3. 17.13.3. Discussion
      4. 17.13.4. See Also
    15. 17.14. Multitasking Server with Threads
      1. 17.14.1. Problem
      2. 17.14.2. Solution
      3. 17.14.3. Discussion
      4. 17.14.4. See Also
    16. 17.15. Writing a Multitasking Server with POE
      1. 17.15.1. Problem
      2. 17.15.2. Solution
      3. 17.15.3. Solution
      4. 17.15.4. See Also
    17. 17.16. Writing a Multihomed Server
      1. 17.16.1. Problem
      2. 17.16.2. Solution
      3. 17.16.3. Discussion
      4. 17.16.4. See Also
    18. 17.17. Making a Daemon Server
      1. 17.17.1. Problem
      2. 17.17.2. Solution
      3. 17.17.3. Discussion
      4. 17.17.4. See Also
    19. 17.18. Restarting a Server on Demand
      1. 17.18.1. Problem
      2. 17.18.2. Solution
      3. 17.18.3. Discussion
      4. 17.18.4. See Also
    20. 17.19. Managing Multiple Streams of Input
      1. 17.19.1. Problem
      2. 17.19.2. Solution
      3. 17.19.3. Discussion
      4. 17.19.4. See Also
    21. 17.20. Program: backsniff
    22. 17.21. Program: fwdport
      1. 17.21.1. See Also
  22. 18. Internet Services
    1. Introduction
    2. 18.1. Simple DNS Lookups
      1. 18.1.1. Problem
      2. 18.1.2. Solution
      3. 18.1.3. Discussion
      4. 18.1.4. See Also
    3. 18.2. Being an FTP Client
      1. 18.2.1. Problem
      2. 18.2.2. Solution
      3. 18.2.3. Discussion
      4. 18.2.4. See Also
    4. 18.3. Sending Mail
      1. 18.3.1. Problem
      2. 18.3.2. Solution
      3. 18.3.3. Discussion
      4. 18.3.4. See Also
    5. 18.4. Reading and Posting Usenet News Messages
      1. 18.4.1. Problem
      2. 18.4.2. Solution
      3. 18.4.3. Discussion
      4. 18.4.4. See Also
    6. 18.5. Reading Mail with POP3
      1. 18.5.1. Problem
      2. 18.5.2. Solution
      3. 18.5.3. Discussion
      4. 18.5.4. See Also
    7. 18.6. Simulating Telnet from a Program
      1. 18.6.1. Problem
      2. 18.6.2. Solution
      3. 18.6.3. Discussion
      4. 18.6.4. See Also
    8. 18.7. Pinging a Machine
      1. 18.7.1. Problem
      2. 18.7.2. Solution
      3. 18.7.3. Discussion
      4. 18.7.4. See Also
    9. 18.8. Accessing an LDAP Server
      1. 18.8.1. Problem
      2. 18.8.2. Solution
      3. 18.8.3. Discussion
      4. 18.8.4. See Also
    10. 18.9. Sending Attachments in Mail
      1. 18.9.1. Problem
      2. 18.9.2. Solution
      3. 18.9.3. Discussion
      4. 18.9.4. See Also
    11. 18.10. Extracting Attachments from Mail
      1. 18.10.1. Problem
      2. 18.10.2. Solution
      3. 18.10.3. Discussion
      4. 18.10.4. See Also
    12. 18.11. Writing an XML-RPC Server
      1. 18.11.1. Problem
      2. 18.11.2. Solution
      3. 18.11.3. Discussion
      4. 18.11.4. See Also
    13. 18.12. Writing an XML-RPC Client
      1. 18.12.1. Problem
      2. 18.12.2. Solution
      3. 18.12.3. Discussion
      4. 18.12.4. See Also
    14. 18.13. Writing a SOAP Server
      1. 18.13.1. Problem
      2. 18.13.2. Solution
      3. 18.13.3. Discussion
      4. 18.13.4. See Also
    15. 18.14. Writing a SOAP Client
      1. 18.14.1. Problem
      2. 18.14.2. Solution
      3. 18.14.3. Discussion
      4. 18.14.4. See Also
    16. 18.15. Program: rfrm
    17. 18.16. Program: expn and vrfy
  23. 19. CGI Programming
    1. Introduction
      1. Architecture
      2. Behind the Scenes
      3. Security
      4. HTML and Forms
      5. Web-Related Resources
    2. 19.1. Writing a CGI Script
      1. 19.1.1. Problem
      2. 19.1.2. Solution
      3. 19.1.3. Discussion
      4. 19.1.4. See Also
    3. 19.2. Redirecting Error Messages
      1. 19.2.1. Problem
      2. 19.2.2. Solution
      3. 19.2.3. Discussion
      4. 19.2.4. See Also
    4. 19.3. Fixing a 500 Server Error
      1. 19.3.1. Problem
      2. 19.3.2. Solution
      3. 19.3.3. Discussion
        1. 19.3.3.1. Make sure the web server can run the script
        2. 19.3.3.2. Make sure the script has permissions to do what it's trying to do
        3. 19.3.3.3. Is the script valid Perl?
        4. 19.3.3.4. Is the script upholding its end of the CGI protocol?
        5. 19.3.3.5. Asking for help elsewhere
      4. 19.3.4. See Also
    5. 19.4. Writing a Safe CGI Program
      1. 19.4.1. Problem
      2. 19.4.2. Solution
      3. 19.4.3. Discussion
      4. 19.4.4. See Also
    6. 19.5. Executing Commands Without Shell Escapes
      1. 19.5.1. Problem
      2. 19.5.2. Solution
      3. 19.5.3. Discussion
      4. 19.5.4. See Also
    7. 19.6. Formatting Lists and Tables with HTML Shortcuts
      1. 19.6.1. Problem
      2. 19.6.2. Solution
      3. 19.6.3. Discussion
      4. 19.6.4. See Also
    8. 19.7. Redirecting to a Different Location
      1. 19.7.1. Problem
      2. 19.7.2. Solution
      3. 19.7.3. Discussion
      4. 19.7.4. See Also
    9. 19.8. Debugging the Raw HTTP Exchange
      1. 19.8.1. Problem
      2. 19.8.2. Solution
      3. 19.8.3. Discussion
      4. 19.8.4. See Also
    10. 19.9. Managing Cookies
      1. 19.9.1. Problem
      2. 19.9.2. Solution
      3. 19.9.3. Discussion
      4. 19.9.4. See Also
    11. 19.10. Creating Sticky Widgets
      1. 19.10.1. Problem
      2. 19.10.2. Solution
      3. 19.10.3. Discussion
      4. 19.10.4. See Also
    12. 19.11. Writing a Multiscreen CGI Script
      1. 19.11.1. Problem
      2. 19.11.2. Solution
      3. 19.11.3. Discussion
      4. 19.11.4. See Also
    13. 19.12. Saving a Form to a File or Mail Pipe
      1. 19.12.1. Problem
      2. 19.12.2. Solution
      3. 19.12.3. Discussion
      4. 19.12.4. See Also
    14. 19.13. Program: chemiserie
  24. 20. Web Automation
    1. Introduction
    2. 20.1. Fetching a URL from a Perl Script
      1. 20.1.1. Problem
      2. 20.1.2. Solution
      3. 20.1.3. Discussion
      4. 20.1.4. See Also
    3. 20.2. Automating Form Submission
      1. 20.2.1. Problem
      2. 20.2.2. Solution
      3. 20.2.3. Discussion
      4. 20.2.4. See Also
    4. 20.3. Extracting URLs
      1. 20.3.1. Problem
      2. 20.3.2. Solution
      3. 20.3.3. Discussion
      4. 20.3.4. See Also
    5. 20.4. Converting ASCII to HTML
      1. 20.4.1. Problem
      2. 20.4.2. Solution
      3. 20.4.3. Discussion
      4. 20.4.4. See Also
    6. 20.5. Converting HTML to ASCII
      1. 20.5.1. Problem
      2. 20.5.2. Solution
      3. 20.5.3. Discussion
      4. 20.5.4. See Also
    7. 20.6. Extracting or Removing HTML Tags
      1. 20.6.1. Problem
      2. 20.6.2. Solution
      3. 20.6.3. Discussion
      4. 20.6.4. See Also
    8. 20.7. Finding Stale Links
      1. 20.7.1. Problem
      2. 20.7.2. Solution
      3. 20.7.3. Discussion
      4. 20.7.4. See Also
    9. 20.8. Finding Fresh Links
      1. 20.8.1. Problem
      2. 20.8.2. Solution
      3. 20.8.3. Discussion
      4. 20.8.4. See Also
    10. 20.9. Using Templates to Generate HTML
      1. 20.9.1. Problem
      2. 20.9.2. Solution
      3. 20.9.3. Discussion
      4. 20.9.4. See Also
    11. 20.10. Mirroring Web Pages
      1. 20.10.1. Problem
      2. 20.10.2. Solution
      3. 20.10.3. Discussion
      4. 20.10.4. See Also
    12. 20.11. Creating a Robot
      1. 20.11.1. Problem
      2. 20.11.2. Solution
      3. 20.11.3. Discussion
      4. 20.11.4. See Also
    13. 20.12. Parsing a Web Server Log File
      1. 20.12.1. Problem
      2. 20.12.2. Solution
      3. 20.12.3. Discussion
      4. 20.12.4. See Also
    14. 20.13. Processing Server Logs
      1. 20.13.1. Problem
      2. 20.13.2. Solution
      3. 20.13.3. Discussion
      4. 20.13.4. See Also
    15. 20.14. Using Cookies
      1. 20.14.1. Problem
      2. 20.14.2. Solution
      3. 20.14.3. Discussion
      4. 20.14.4. See Also
    16. 20.15. Fetching Password-Protected Pages
      1. 20.15.1. Problem
      2. 20.15.2. Solution
      3. 20.15.3. Discussion
      4. 20.15.4. See Also
    17. 20.16. Fetching https:// Web Pages
      1. 20.16.1. Problem
      2. 20.16.2. Solution
      3. 20.16.3. Discussion
      4. 20.16.4. See Also
    18. 20.17. Resuming an HTTP GET
      1. 20.17.1. Problem
      2. 20.17.2. Solution
      3. 20.17.3. Discussion
      4. 20.17.4. See Also
    19. 20.18. Parsing HTML
      1. 20.18.1. Problem
      2. 20.18.2. Solution
      3. 20.18.3. Discussion
      4. 20.18.4. See Also
    20. 20.19. Extracting Table Data
      1. 20.19.1. Problem
      2. 20.19.2. Solution
      3. 20.19.3. Discussion
      4. 20.19.4. See Also
    21. 20.20. Program: htmlsub
    22. 20.21. Program: hrefsub
  25. 21. mod_perl
    1. Introduction
      1. Handlers
      2. Apache Phases
      3. More Documentation
      4. mod_perl 2
    2. 21.1. Authenticating
      1. 21.1.1. Problem
      2. 21.1.2. Solution
      3. 21.1.3. Description
      4. 21.1.4. See Also
    3. 21.2. Setting Cookies
      1. 21.2.1. Problem
      2. 21.2.2. Solution
      3. 21.2.3. Description
      4. 21.2.4. See Also
    4. 21.3. Accessing Cookie Values
      1. 21.3.1. Problem
      2. 21.3.2. Solution
      3. 21.3.3. Discussion
      4. 21.3.4. See Also
    5. 21.4. Redirecting the Browser
      1. 21.4.1. Problem
      2. 21.4.2. Solution
      3. 21.4.3. Discussion
      4. 21.4.4. See Also
    6. 21.5. Interrogating Headers
      1. 21.5.1. Problem
      2. 21.5.2. Solution
      3. 21.5.3. Discussion
      4. 21.5.4. See Also
    7. 21.6. Accessing Form Parameters
      1. 21.6.1. Problem
      2. 21.6.2. Solution
      3. 21.6.3. Discussion
      4. 21.6.4. See Also
    8. 21.7. Receiving Uploaded Files
      1. 21.7.1. Problem
      2. 21.7.2. Solution
      3. 21.7.3. Discussion
      4. 21.7.4. See Also
    9. 21.8. Speeding Up Database Access
      1. 21.8.1. Problem
      2. 21.8.2. Solution
      3. 21.8.3. Discussion
      4. 21.8.4. See Also
    10. 21.9. Customizing Apache's Logging
      1. 21.9.1. Problem
      2. 21.9.2. Solution
      3. 21.9.3. Discussion
      4. 21.9.4. See Also
    11. 21.10. Transparently Storing Information in URLs
      1. 21.10.1. Problem
      2. 21.10.2. Solution
      3. 21.10.3. Discussion
      4. 21.10.4. See Also
    12. 21.11. Communicating Between mod_perl and PHP
      1. 21.11.1. Problem
      2. 21.11.2. Solution
      3. 21.11.3. Discussion
      4. 21.11.4. See Also
    13. 21.12. Migrating from CGI to mod_perl
      1. 21.12.1. Problem
      2. 21.12.2. Solution
      3. 21.12.3. Discussion
      4. 21.12.4. See Also
    14. 21.13. Sharing Information Between Handlers
      1. 21.13.1. Problem
      2. 21.13.2. Solution
      3. 21.13.3. Discussion
      4. 21.13.4. See Also
    15. 21.14. Reloading Changed Modules
      1. 21.14.1. Problem
      2. 21.14.2. Solution
      3. 21.14.3. Discussion
      4. 21.14.4. See Also
    16. 21.15. Benchmarking a mod_perl Application
      1. 21.15.1. Problem
      2. 21.15.2. Solution
      3. 21.15.3. Discussion
      4. 21.15.4. See Also
    17. 21.16. Templating with HTML::Mason
      1. 21.16.1. Problem
      2. 21.16.2. Solution
      3. 21.16.3. Discussion
        1. 21.16.3.1. Configuration
        2. 21.16.3.2. Basic Mason syntax
        3. 21.16.3.3. Objects
        4. 21.16.3.4. Autohandlers
        5. 21.16.3.5. Dhandlers
      4. 21.16.4. See Also
    18. 21.17. Templating with Template Toolkit
      1. 21.17.1. Problem
      2. 21.17.2. Solution
      3. 21.17.3. Discussion
        1. 21.17.3.1. Configuration
        2. 21.17.3.2. Syntax
        3. 21.17.3.3. Perl code
        4. 21.17.3.4. Data structures
        5. 21.17.3.5. Subroutines
        6. 21.17.3.6. Including other templates
        7. 21.17.3.7. Parameters
        8. 21.17.3.8. Plug-ins
      4. 21.17.4. See Also
  26. 22. XML
    1. Introduction
      1. Syntax
      2. XML Declaration
      3. Processing Instructions
      4. Comments
      5. CDATA
      6. Well-Formed XML
      7. Schemas
      8. Namespaces
      9. Transformations
      10. Paths
      11. History of Perl and XML
      12. Further Reading
    2. 22.1. Parsing XML into Data Structures
      1. 22.1.1. Problem
      2. 22.1.2. Solution
      3. 22.1.3. Discussion
      4. 22.1.4. See Also
    3. 22.2. Parsing XML into a DOM Tree
      1. 22.2.1. Problem
      2. 22.2.2. Solution
      3. 22.2.3. Discussion
      4. 22.2.4. See Also
    4. 22.3. Parsing XML into SAX Events
      1. 22.3.1. Problem
      2. 22.3.2. Solution
      3. 22.3.3. Discussion
      4. 22.3.4. See Also
    5. 22.4. Making Simple Changes to Elements or Text
      1. 22.4.1. Problem
      2. 22.4.2. Solution
      3. 22.4.3. Discussion
      4. 22.4.4. See Also
    6. 22.5. Validating XML
      1. 22.5.1. Problem
      2. 22.5.2. Solution
      3. 22.5.3. Discussion
      4. 22.5.4. See Also
    7. 22.6. Finding Elements and Text Within an XML Document
      1. 22.6.1. Problem
      2. 22.6.2. Solution
      3. 22.6.3. Discussion
      4. 22.6.4. See Also
    8. 22.7. Processing XML Stylesheet Transformations
      1. 22.7.1. Problem
      2. 22.7.2. Solution
      3. 22.7.3. Discussion
      4. 22.7.4. See Also
    9. 22.8. Processing Files Larger Than Available Memory
      1. 22.8.1. Problem
      2. 22.8.2. Solution
      3. 22.8.3. Discussion
      4. 22.8.4. See Also
    10. 22.9. Reading and Writing RSS Files
      1. 22.9.1. Problem
      2. 22.9.2. Solution
      3. 22.9.3. Discussion
      4. 22.9.4. See Also
    11. 22.10. Writing XML
      1. 22.10.1. Problem
      2. 22.10.2. Solution
      3. 22.10.3. Discussion
      4. 22.10.4. See Also
  27. About the Authors
  28. Colophon
  29. Copyright