-
Chapter 1 Introduction
-
What Should You Know Already?
-
What About All Those Footnotes?
-
What's with the Exercises?
-
What if I'm a Perl Course Instructor?
-
-
Chapter 2 Building Larger Programs
-
The Cure for the Common Code
-
Inserting Code with eval
-
Using do
-
Using require
-
require and @INC
-
The Problem of Namespace Collisions
-
Packages as Namespace Separators
-
Scope of a Package Directive
-
Packages and Lexicals
-
Exercises
-
-
Chapter 3 Introduction to References
-
Performing the Same Task on Many Arrays
-
Taking a Reference to an Array
-
Dereferencing the Array Reference
-
Dropping Those Braces
-
Modifying the Array
-
Nested Data Structures
-
Simplifying Nested Element References with Arrows
-
References to Hashes
-
Exercises
-
-
Chapter 4 References and Scoping
-
More than One Reference to Data
-
What if That Was the Name?
-
Reference Counting and Nested Data Structures
-
When Reference Counting Goes Bad
-
Creating an Anonymous Array Directly
-
Creating an Anonymous Hash
-
Autovivification
-
Autovivification and Hashes
-
Exercises
-
-
Chapter 5 Manipulating Complex Data Structures
-
Using the Debugger to View Complex Data
-
Viewing Complex Data with Data::Dumper
-
Storing Complex Data with Storable
-
The map and grep Operators
-
Using map
-
Applying a Bit of Indirection
-
Selecting and Altering Complex Data
-
Exercises
-
-
Chapter 6 Subroutine References
-
Referencing a Named Subroutine
-
Anonymous Subroutines
-
Callbacks
-
Closures
-
Returning a Subroutine from a Subroutine
-
Closure Variables as Inputs
-
Closure Variables as Static Local Variables
-
Exercise
-
-
Chapter 7 Practical Reference Tricks
-
Review of Sorting
-
Sorting with Indices
-
Sorting Efficiently
-
The Schwartzian Transform
-
Recursively Defined Data
-
Building Recursively Defined Data
-
Displaying Recursively Defined Data
-
Exercises
-
-
Chapter 8 Introduction to Objects
-
If We Could Talk to the Animals...
-
Introducing the Method Invocation Arrow
-
The Extra Parameter of Method Invocation
-
Calling a Second Method to Simplify Things
-
A Few Notes About @ISA
-
Overriding the Methods
-
Starting the Search from a Different Place
-
The SUPER Way of Doing Things
-
What to Do with @_
-
Where We Are So Far...
-
Exercises
-
-
Chapter 9 Objects with Data
-
A Horse Is a Horse, of Course of Course—or Is It?
-
Invoking an Instance Method
-
Accessing the Instance Data
-
How to Build a Horse
-
Inheriting the Constructor
-
Making a Method Work with Either Classes or Instances
-
Adding Parameters to a Method
-
More Interesting Instances
-
A Horse of a Different Color
-
Getting Your Deposit Back
-
Don't Look Inside the Box
-
Faster Getters and Setters
-
Getters That Double as Setters
-
Restricting a Method to Class-Only or Instance-Only
-
Exercise
-
-
Chapter 10 Object Destruction
-
Nested Object Destruction
-
Beating a Dead Horse
-
Indirect Object Notation
-
Additional Instance Variables in Subclasses
-
Using Class Variables
-
Weakening the Argument
-
Exercise
-
-
Chapter 11 Some Advanced Object Topics
-
UNIVERSAL Methods
-
Testing Your Objects for Good Behavior
-
AUTOLOAD as a Last Resort
-
Using AUTOLOAD for Accessors
-
Creating Getters and Setters More Easily
-
Multiple Inheritance
-
References to Filehandles
-
Exercise
-
-
Chapter 12 Using Modules
-
Sample Function-Oriented Interface: File::Basename
-
Selecting What to Import
-
Sample Object-Oriented Interface: File::Spec
-
A More Typical Object-Oriented Module: Math::BigInt
-
The Differences Between OO and Non-OO Modules
-
What use Is Doing
-
Setting the Path at the Right Time
-
Importing with Exporter
-
@EXPORT and @EXPORT_OK
-
Exporting in a Primarily OO Module
-
Custom Import Routines
-
Exercise
-
-
Chapter 13 Writing a Distribution
-
Starting with h2xs
-
Looking at the Templates
-
The Prototype Module Itself
-
Embedded Documentation
-
Controlling the Distribution with Makefile.PL
-
Alternate Installation Locations (PREFIX=...)
-
Trivial make test
-
Trivial make install
-
Trivial make dist
-
Using the Alternate Library Location
-
Exercise
-
-
Chapter 14 Essential Testing
-
What the Test Harness Does
-
Writing Tests with Test::Simple
-
Writing Tests with Test::More
-
Conditional Tests
-
More Complex Tests (Multiple Test Scripts)
-
Testing Things That Write to STDOUT and STDERR
-
Exercise
-
-
Chapter 15 Contributing to CPAN
-
The Comprehensive Perl Archive Network
-
Getting Prepared
-
Preparing Your Distribution
-
Uploading Your Distribution
-
Announcing the Module
-
Testing on Multiple Platforms
-
Consider Writing an Article or Giving a Talk
-
Exercise
-
-
Appendix A Answers to Exercises
-
Answers for Chapter 2
-
Answers for Chapter 3
-
Answers for Chapter 4
-
Answers for Chapter 5
-
Answer for Chapter 6
-
Answers for Chapter 7
-
Answers for Chapter 8
-
Answer for Chapter 9
-
Answer for Chapter 10
-
Answer for Chapter 11
-
Answer for Chapter 12
-
Answers for Chapters 13-15
-
-
Colophon
- Title:
- Learning Perl Objects, References, and Modules
- By:
- Randal L. Schwartz, Tom Phoenix
- Publisher:
- O'Reilly Media
- Formats:
-
- Safari Books Online
- Print Release:
- June 2003
- Pages:
- 224
- Print ISBN:
- 978-0-596-00478-1
- | ISBN 10:
- 0-596-00478-8
Our look is the result of reader comments, our own experimentation, and feedback from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects. The animal on the cover of Learning Perl Objects, References, and Modules is an alpaca (Lama pacos). The alpaca is a member of the South American camelid family, which is closely related to the more familiar Asian and African camels. South American camelids also include the llama, the vicuna, and the guanaco. The alpaca is smaller (36 inches at the withers) than a llama, but larger than its other relations. Ninety-nine percent of the world's approximately three million alpacas are found in Peru, Bolivia, and Chile.
The evolution of the wild vicuna into the domestic alpaca began between six and seven thousand years ago. The specialized breeding of alpacas for fiber production wasn't developed until around 500 B.C. The Incas developed the alpaca into the two distinct fleece types, the Huacaya (pronounced wa-kai-ya) and the less common Suri. The main difference between the two types of alpacas is the fiber they produce. The Huacaya fleece has crimp or wave; the Suri fleece is silky and lustrous and has no crimp. Alpacas are prized for their fleece, which is as soft as cashmere and warmer, lighter, and stronger than wool. Alpaca fleece comes in more colors than that of any other fiber-producing animal (approximately 22 basic colors with many variations and blends).
The lifespan of the alpaca is about 20 years. Gestation is 11.5 months, producing one offspring, or cria, every 14 to 15 months. The alpaca is a modified ruminant, not only eating less grass than most other animals but converting it to energy very efficiently. Unlike true ruminants, they have three compartments in their stomach, not four, and can thus survive in areas unsuitable to other domesticated animals. Alpacas are gentle and don't bite or butt. Even if they did, without incisors, horns, hoofs, or claws, they would do little damage. Mary Anne Weeks Mayo was the production editor and proofreader, and Ann Schirmer was the copyeditor for Learning Perl Objects, References, and Modules. Matt Hutchinson and Claire Cloutier provided quality control. Jamie Peppard provided production assistance. Lucie Haskins wrote the index.
Ellie Volckhausen designed the cover of this book, based on a series design by Edie Freedman. The cover image is a 19th-century engraving from Animate Creations, Volume II. Emma Colby produced the cover layout with QuarkXPress 4.1 using Adobe's ITC Garamond font.
David Futato designed the interior layout. This book was converted by Andrew Savikas to FrameMaker 5.5.6 with a format conversion tool created by Erik Ray, Jason McIntosh, Neil Walls, and Mike Sierra that uses Perl and XML technologies. The text font is Linotype Birka; the heading font is Adobe Myriad Condensed; and the code font is LucasFont's TheSans Mono Condensed. The illustrations that appear in the book were produced by Robert Romano and Jessamyn Read using Macromedia FreeHand 9 and Adobe Photoshop 6. This colophon was compiled by Mary Anne Weeks Mayo.
