SitemapMain PageTable of contentCopyrightForewordPrefaceStructure of This BookConventions Used in This BookComments and QuestionsAcknowledgmentsChapter 1. Introduction1.1 What Should You Know Already?1.2 What About All Those Footnotes?1.3 What's with the Exercises?1.4 What if I'm a Perl Course Instructor?Chapter 2. Building Larger Programs2.1 The Cure for the Common Code2.2 Inserting Code with eval2.3 Using do2.4 Using require2.5 require and @INC2.6 The Problem of Namespace Collisions2.7 Packages as Namespace Separators2.8 Scope of a Package Directive2.9 Packages and Lexicals2.10 ExercisesChapter 3. Introduction to References3.1 Performing the Same Task on Many Arrays3.2 Taking a Reference to an Array3.3 Dereferencing the Array Reference3.4 Dropping Those Braces3.5 Modifying the Array3.6 Nested Data Structures3.7 Simplifying Nested Element References with Arrows3.8 References to Hashes3.9 ExercisesChapter 4. References and Scoping4.1 More than One Reference to Data4.2 What if That Was the Name?4.3 Reference Counting and Nested Data Structures4.4 When Reference Counting Goes Bad4.5 Creating an Anonymous Array Directly4.6 Creating an Anonymous Hash4.7 Autovivification4.8 Autovivification and Hashes4.9 ExercisesChapter 5. Manipulating Complex Data Structures5.1 Using the Debugger to View Complex Dataumper5.3 Storing Complex Data with Storable5.4 The map and grep Operators5.5 Using map5.6 Applying a Bit of Indirection5.7 Selecting and Altering Complex Data5.8 ExercisesChapter 6. Subroutine References6.1 Referencing a Named Subroutine6.2 Anonymous Subroutines6.3 Callbacks6.4 Closures6.5 Returning a Subroutine from a Subroutine6.6 Closure Variables as Inputs6.7 Closure Variables as Static Local Variables6.8 ExerciseChapter 7. Practical Reference Tricks7.1 Review of Sorting7.2 Sorting with Indices7.3 Sorting Efficiently7.4 The Schwartzian Transform7.5 Recursively Defined Data7.6 Building Recursively Defined Data7.7 Displaying Recursively Defined Data7.8 ExercisesChapter 8. Introduction to Objects8.1 If We Could Talk to the Animals...8.2 Introducing the Method Invocation Arrow8.3 The Extra Parameter of Method Invocation8.3 The Extra Parameter of Method Invocation8.4 Calling a Second Method to Simplify Things8.5 A Few Notes About @ISA8.6 Overriding the Methods8.7 Starting the Search from a Different Place8.8 The SUPER Way of Doing Things8.9 What to Do with @_8.10 Where We Are So Far...8.11 ExercisesChapter 9. Objects with Data9.1 A Horse Is a Horse, of Course of Courseor Is It?9.2 Invoking an Instance Method9.3 Accessing the Instance Data9.4 How to Build a Horse9.5 Inheriting the Constructor9.6 Making a Method Work with Either Classes or Instances9.7 Adding Parameters to a Method9.7 Adding Parameters to a Method9.8 More Interesting Instances9.9 A Horse of a Different Color9.10 Getting Your Deposit Back9.11 Don't Look Inside the Box9.12 Faster Getters and Setters9.13 Getters That Double as Setters9.14 Restricting a Method to Class-Only or Instance-Only9.15 ExerciseChapter 10. Object Destruction10.1 Nested Object Destruction10.2 Beating a Dead Horse10.3 Indirect Object Notation10.4 Additional Instance Variables in Subclasses10.5 Using Class Variables10.6 Weakening the Argument10.7 ExerciseChapter 11. Some Advanced Object Topics11.1 UNIVERSAL Methods11.2 Testing Your Objects for Good Behavior11.3 AUTOLOAD as a Last Resort11.4 Using AUTOLOAD for Accessors11.5 Creating Getters and Setters More Easily11.6 Multiple Inheritance11.7 References to Filehandles11.8 ExerciseChapter 12. Using Modulesasename12.2 Selecting What to ImportpecigInt12.5 The Differences Between OO and Non-OO Modules12.6 What use Is Doing12.7 Setting the Path at the Right Time12.8 Importing with Exporter12.9 @EXPORT and @EXPORT_OK12.10 Exporting in a Primarily OO Module12.11 Custom Import Routines12.12 ExerciseChapter 13. Writing a Distribution13.1 Starting with h2xs13.2 Looking at the Templates13.3 The Prototype Module Itself13.4 Embedded Documentation13.5 Controlling the Distribution with Makefile.PL13.6 Alternate Installation Locations (PREFIX=...)13.7 Trivial make test13.8 Trivial make install13.9 Trivial make dist13.10 Using the Alternate Library Location13.11 ExerciseChapter 14. Essential Testing14.1 What the Test Harness Doesimpleore14.4 Conditional Tests14.5 More Complex Tests (Multiple Test Scripts)14.6 Testing Things That Write to STDOUT and STDERR14.7 ExerciseChapter 15. Contributing to CPAN15.1 The Comprehensive Perl Archive Network15.2 Getting Prepared15.3 Preparing Your Distribution15.4 Uploading Your Distribution15.5 Announcing the Module15.6 Testing on Multiple Platforms15.7 Consider Writing an Article or Giving a Talk15.8 ExerciseAppendix A. Answers to ExercisesA.1 Answers for Chapter 2A.2 Answers for Chapter 3A.3 Answers for Chapter 4A.4 Answers for Chapter 5A.5 Answer for Chapter 6A.6 Answers for Chapter 7A.7 Answers for Chapter 8A.8 Answer for Chapter 9A.9 Answer for Chapter 10A.10 Answer for Chapter 11A.11 Answer for Chapter 12A.12 Answers for Chapters 13-15ColophonIndexIndex SYMBOLIndex AIndex BIndex CIndex DIndex EIndex FIndex GIndex HIndex IIndex KIndex LIndex MIndex NIndex OIndex PIndex QIndex RIndex SIndex TIndex UIndex VIndex WIndex X