Modern Perl: 2011-2012 edition
  • Table of Contents
  • Index
  • Modern Perl Books

Contents

  • Preface
  • The Perl Philosophy
  • Perl and Its Community
  • The Perl Language
  • Operators
  • Functions
  • Regular Expressions and Matching
  • Objects
  • Style and Efficacy
  • Managing Real Programs
  • Perl Beyond Syntax
  • What to Avoid
  • What's Missing
  • → Table of Contents ←
  • Index

This book is free!

Visit Modern Perl to download your own copy of this book. You can also buy a printed copy!

Modern Perl at Powell's
Modern Perl at B&N
Modern Perl at Amazon

© 2010-2012 chromatic

Published by Onyx Neon

    Preface

    • Running Modern Perl
    • Credits

    The Perl Philosophy

    • Perldoc
    • Expressivity
    • Context
      • Void, Scalar, and List Context
      • Numeric, String, and Boolean Context
    • Implicit Ideas
      • The Default Scalar Variable
      • The Default Array Variables

    Perl and Its Community

    • The CPAN
      • CPAN Management Tools
    • Community Sites
    • Development Sites
    • Events
    • IRC

    The Perl Language

    • Names
      • Variable Names and Sigils
      • Namespaces
    • Variables
      • Variable Scopes
      • Variable Sigils
      • Anonymous Variables
      • Variables, Types, and Coercion
    • Values
      • Strings
      • Unicode and Strings
        • Character Encodings
        • Unicode in Your Filehandles
        • Unicode in Your Data
        • Unicode in Your Programs
        • Implicit Conversion
      • Numbers
      • Undef
      • The Empty List
      • Lists
    • Control Flow
      • Branching Directives
      • The Ternary Conditional Operator
        • Short Circuiting
      • Context for Conditional Directives
      • Looping Directives
      • Iteration and Aliasing
      • Iteration and Scoping
      • The C-Style For Loop
      • While and Until
      • Loops within Loops
      • Loop Control
      • Continue
      • Given/When
      • Tailcalls
    • Scalars
      • Scalars and Types
    • Arrays
      • Array Elements
      • Array Assignment
      • Array Operations
      • Array Slices
      • Arrays and Context
      • Array Interpolation
    • Hashes
      • Declaring Hashes
      • Hash Indexing
      • Hash Key Existence
      • Accessing Hash Keys and Values
      • Hash Slices
      • The Empty Hash
      • Hash Idioms
      • Locking Hashes
    • Coercion
      • Boolean Coercion
      • String Coercion
      • Numeric Coercion
      • Reference Coercion
      • Cached Coercions
      • Dualvars
    • Packages
      • Packages and Namespaces
    • References
      • Scalar References
      • Array References
      • Hash References
      • Automatic Dereferencing
      • Function References
      • Filehandle References
      • Reference Counts
      • References and Functions
    • Nested Data Structures
      • Autovivification
      • Debugging Nested Data Structures
      • Circular References
      • Alternatives to Nested Data Structures

    Operators

    • Operator Characteristics
      • Precedence
      • Associativity
      • Arity
      • Fixity
    • Operator Types
      • Numeric Operators
      • String Operators
      • Logical Operators
      • Bitwise Operators
      • Special Operators

    Functions

    • Declaring Functions
    • Invoking Functions
    • Function Parameters
      • Flattening
      • Slurping
      • Aliasing
    • Functions and Namespaces
      • Importing
    • Reporting Errors
      • Validating Arguments
    • Advanced Functions
      • Context Awareness
      • Recursion
      • Lexicals
      • Tail Calls
    • Pitfalls and Misfeatures
    • Scope
      • Lexical Scope
      • Our Scope
      • Dynamic Scope
      • State Scope
    • Anonymous Functions
      • Declaring Anonymous Functions
      • Anonymous Function Names
      • Implicit Anonymous Functions
    • Closures
      • Creating Closures
      • Uses of Closures
      • Closures and Partial Application
    • State versus Closures
    • State versus Pseudo-State
    • Attributes
      • Using Attributes
      • Drawbacks of Attributes
    • AUTOLOAD
      • Basic Features of AUTOLOAD
      • Redispatching Methods in AUTOLOAD()
      • Generating Code in AUTOLOAD()
      • Drawbacks of AUTOLOAD

    Regular Expressions and Matching

    • Literals
    • The qr// Operator and Regex Combinations
    • Quantifiers
    • Greediness
    • Regex Anchors
    • Metacharacters
    • Character Classes
    • Capturing
      • Named Captures
      • Numbered Captures
    • Grouping and Alternation
    • Other Escape Sequences
    • Assertions
    • Regex Modifiers
    • Smart Matching

    Objects

    • Moose
      • Classes
      • Methods
      • Attributes
      • Encapsulation
        • Polymorphism
      • Roles
        • Roles and DOES()
      • Inheritance
        • Inheritance and Attributes
        • Method Dispatch Order
        • Inheritance and Methods
        • Inheritance and isa()
      • Moose and Perl 5 OO
    • Blessed References
      • Method Lookup and Inheritance
      • AUTOLOAD
      • Method Overriding and SUPER
      • Strategies for Coping with Blessed References
    • Reflection
      • Checking that a Module Has Loaded
      • Checking that a Package Exists
      • Checking that a Class Exists
      • Checking a Module Version Number
      • Checking that a Function Exists
      • Checking that a Method Exists
      • Rooting Around in Symbol Tables
    • Advanced OO Perl
      • Favor Composition Over Inheritance
      • Single Responsibility Principle
      • Don't Repeat Yourself
      • Liskov Substitution Principle
      • Subtypes and Coercions
      • Immutability

    Style and Efficacy

    • Writing Maintainable Perl
    • Writing Idiomatic Perl
    • Writing Effective Perl
    • Exceptions
      • Throwing Exceptions
      • Catching Exceptions
      • Exception Caveats
      • Built-in Exceptions
    • Pragmas
      • Pragmas and Scope
      • Using Pragmas
      • Useful Pragmas

    Managing Real Programs

    • Testing
      • Test::More
      • Running Tests
      • Better Comparisons
      • Organizing Tests
      • Other Testing Modules
    • Handling Warnings
      • Producing Warnings
      • Enabling and Disabling Warnings
      • Disabling Warning Categories
      • Making Warnings Fatal
      • Catching Warnings
      • Registering Your Own Warnings
    • Files
      • Input and Output
        • Two-argument open
        • Reading from Files
        • Writing to Files
        • Closing Files
        • Special File Handling Variables
      • Directories and Paths
        • Manipulating Paths
      • File Manipulation
    • Modules
      • Using and Importing
      • Exporting
      • Organizing Code with Modules
    • Distributions
      • Attributes of a Distribution
      • CPAN Tools for Managing Distributions
      • Designing Distributions
    • The UNIVERSAL Package
      • The isa() Method
      • The can() Method
      • The VERSION() Method
      • The DOES() Method
      • Extending UNIVERSAL
    • Code Generation
      • eval
      • Parametric Closures
      • Compile-time Manipulation
      • Class::MOP
    • Overloading
      • Overloading Common Operations
      • Overload and Inheritance
      • Uses of Overloading
    • Taint
      • Using Taint Mode
      • Sources of Taint
      • Removing Taint from Data
      • Removing Taint from the Environment
      • Taint Gotchas

    Perl Beyond Syntax

    • Idioms
      • The Object as $self
      • Named Parameters
      • The Schwartzian Transform
      • Easy File Slurping
      • Handling Main
      • Controlled Execution
      • Postfix Parameter Validation
      • Regex En Passant
      • Unary Coercions
    • Global Variables
      • Managing Super Globals
      • English Names
      • Useful Super Globals
      • Alternatives to Super Globals

    What to Avoid

    • Barewords
      • Good Uses of Barewords
        • Bareword hash keys
        • Bareword package names
        • Bareword named code blocks
        • Bareword constants
      • Ill-Advised Uses of Barewords
        • Bareword function calls
        • Bareword hash values
        • Bareword filehandles
        • Bareword sort functions
    • Indirect Objects
      • Bareword Indirect Invocations
      • Indirect Notation Scalar Limitations
      • Alternatives to Indirect Notation
    • Prototypes
      • The Problem with Prototypes
      • Good Uses of Prototypes
    • Method-Function Equivalence
      • Caller-side
      • Callee-side
    • Tie
      • Tying Variables
      • Implementing Tied Variables
      • When to use Tied Variables

    What's Missing

    • Missing Defaults
      • The strict Pragma
      • The warnings Pragma
      • IO::File and IO::Handle
      • The autodie Pragma