You are previewing Pro Perl.
O'Reilly logo
Pro Perl

Book Description

Over the years, Perl has grown from an elegant scripting tool into a mature and full-featured language for application development, boasting object-oriented programming, a flexible threading model, built-in support for Unicode, and a thriving community. Available on almost every platform, and offering a comprehensive library of modules, there is no task too big or small for Perl to tackle.

Pro Perl helps you master the key features and complexities of this powerful language. Aimed at intermediate and advanced developers alike, the material assumes some general knowledge of programming concepts but not necessarily prior Perl experience. However, given the expansive coverage of core language topics, Pro Perl also serves as a valuable guide to seasoned Perl programmers seeking to push their proficiency to the next level.

Using a depth-first approach to aid learning of advanced concepts, you're provided with detailed examinations of many key topics, including regular expressions, networking, modules and packages, object-oriented development, and much more. Pro Perl seeks to provide developers with not only the answers to their programming questions, but also advanced ideas and related concepts that expand the developer's understanding of Perl as a language.

Table of Contents

  1. Title Page
  2. Contents at a Glance
  3. Contents
  4. About the Author
  5. About the Technical Reviewer
  6. Introduction
  7. CHAPTER 1: Introducing Perl
    1. Introduction
    2. Building and Installing Perl
    3. Running Perl
    4. Installing Modules
    5. Summary
  8. CHAPTER 2: Basic Concepts
    1. Values and Variables
    2. Comments and Whitespace
    3. Operators and Functions
    4. Expressions and Statements
    5. Data Types
    6. Context
    7. Special Variables
    8. String Interpolation
    9. Matching, Substitution, and Transliteration
    10. Blocks, Conditions, and Loops
    11. Subroutines
    12. Modules and Packages
    13. Warnings and Strictness
    14. Variable Declarations
    15. Summary
  9. CHAPTER 3: Scalars: Integers, Floating-Point Numbers, and Strings
    1. Automatic Conversion: One Scalar Fits All
    2. Numbers
    3. Strings
    4. Schizophrenic Scalars
    5. Summary
  10. CHAPTER 4: Operators
    1. Operator Types and Categories
    2. Precedence and Associativity
    3. Disabling Functions and Operators
    4. Overloading Operators
    5. Operators vs. Functions
    6. Summary
  11. CHAPTER 5: Arrays, Hashes, References, and Typeglobs
    1. Lists and Arrays
    2. Hashes
    3. References
    4. Complex Data Structures
    5. Typeglobs
    6. The Undefined Value
    7. Constants
    8. Summary
  12. CHAPTER 6: Structure, Flow, and Control
    1. Declarations, Statements, Expressions, and Blocks
    2. Conditional Statements
    3. Loops and Looping
    4. Summary
  13. CHAPTER 7: Subroutines
    1. Declaring and Calling Subroutines
    2. Passing Parameters
    3. Prototypes
    4. Returning Values from Subroutines
    5. Closures
    6. Attributes
    7. Summary
  14. CHAPTER 8: Scope and Visibility
    1. Package Variables
    2. Lexical Variables
    3. The Symbol Table
    4. Summary
  15. CHAPTER 9: Using Modules
    1. Loading Code Using do, require, and use
    2. Pragmatic Modules
    3. The Special Hash %INC
    4. The Special Array @INC
    5. Locating Libraries Relative to the Script
    6. Checking for the Availability of a Module
    7. Finding Out What Modules Are Installed
    8. Postponing Module Loading Until Use with autouse
    9. Summary
  16. CHAPTER 10: Inside Modules and Packages
    1. Modules and Packages
    2. BEGIN Blocks, END Blocks, and Other Animals
    3. Autoloading
    4. Importing and Exporting
    5. Package Attributes
    6. Creating Installable Modules
    7. Summary
  17. CHAPTER 11: Interpolation and Regular Expressions
    1. String Interpolation
    2. Interpolating Variables
    3. Regular Expressions
    4. Transliteration
    5. Summary
  18. CHAPTER 12: Input and Output with Filehandles
    1. IO and Filehandles
    2. The Filehandle Data Type
    3. Standard Filehandles
    4. Creating Filehandles
    5. Referring to Filehandles
    6. Reading from Filehandles
    7. Writing to Filehandles
    8. Binary and Text Files, Layers, Encodings, and Transforms
    9. Random Access
    10. Truncating and Resizing Files
    11. File Locking
    12. Changing the Default Output Filehandle
    13. Duplicating and Aliasing Filehandles
    14. Redirecting Filehandles
    15. Caching Many Filehandles
    16. IO::Handle Methods and Special Variables
    17. System-Level IO
    18. Summary
  19. CHAPTER 13: Files and Directories
    1. Querying and Manipulating Files
    2. Querying and Manipulating Directories
    3. Summary
  20. CHAPTER 14: Command Line and Shell Interaction
    1. Parsing Command-Line Arguments
    2. Getting and Setting the Program Name
    3. Reading from the Environment
    4. Writing Shells in Perl
    5. Summary
  21. CHAPTER 15: Terminal Input and Output
    1. Determining Whether a Script Is Interactive
    2. Reading from the Keyboard
    3. Writing to the Screen
    4. Higher-Level Terminal Modules
    5. Programming the Terminal Directly with POSIX
    6. Summary
  22. CHAPTER 16: Warnings and Errors
    1. Enabling Warnings
    2. Enabling Better Diagnostics
    3. Generating Warnings and Errors
    4. Intercepting Warnings and Errors
    5. Warnings and Errors with Calling Context
    6. Warnings Categories
    7. Handling Error Results from System Calls
    8. Error Logs and System Logs
    9. Summary
  23. CHAPTER 17: Debugging, Testing, and Profiling
    1. Debugging Without the Debugger
    2. The Perl Debugger
    3. Debugging and Informational Modules
    4. Debugging Perl Itself
    5. Automated Testing
    6. Profiling
    7. Summary
  24. CHAPTER 18: Text Processing, Documentation, and Reports
    1. Text Processing
    2. Documenting Perl
    3. Source Filters
    4. Reports: The “R” in Perl
    5. Summary
  25. CHAPTER 19: Object-Oriented Perl
    1. Introducing Objects
    2. Programming with Objects
    3. Writing Object Classes
    4. Inheritance and Subclassing
    5. Autoloading Methods
    6. Keeping Data Private
    7. Destroying Objects
    8. Overloading Operators
    9. Automating Object Class Development
    10. Ties and Tied Objects
    11. Summary
  26. CHAPTER 20: Extending and Embedding Perl
    1. Using Perl from C or C++
    2. Using C or C++ from Perl
    3. Inlining C and Other Languages into Perl
    4. Compiling Perl
    5. Summary
  27. CHAPTER 21: Processes, Signals, and Threads
    1. Signals
    2. Starting New Processes
    3. Handling Children and Reaping Exit Codes
    4. Communicating Between Processes
    5. Sharing Data Between Processes
    6. Threads
    7. Summary
  28. CHAPTER 22: Networking
    1. Sockets
    2. Implementing Servers and Clients
    3. Writing Multiplexed Servers
    4. Getting Network Information
    5. Summary
  29. CHAPTER 23: Unicode, Locale, and Internationalization
    1. A Brief History of Symbols
    2. Unicode in Perl
    3. Locale
    4. Internationalization
    5. Summary
  30. INDEX