Buying Options
Learning Perl Objects, References, and Modules
Safari Books Online
Add to Cart
What is this?
Description
Learning Perl Objects, References & Modules picks up where Learning Perl leaves off. This new book offers a gentle introduction to the world of references, object-oriented programming, and the use of Perl modules that form the backbone of any effective Perl program. Following the successful format of Learning Perl, each chapter in the book is designed to be small enough to be read in just an hour or two. Each chapter ends with a series of exercises to help you practice what you've learned with answers in an appendix for your reference. In short, this book covers everything that separates the Perl dabbler from the Perl programmer.
Full Description
Table of Contents
  1. Chapter 1 Introduction

    1. What Should You Know Already?

    2. What About All Those Footnotes?

    3. What's with the Exercises?

    4. What if I'm a Perl Course Instructor?

  2. Chapter 2 Building Larger Programs

    1. The Cure for the Common Code

    2. Inserting Code with eval

    3. Using do

    4. Using require

    5. require and @INC

    6. The Problem of Namespace Collisions

    7. Packages as Namespace Separators

    8. Scope of a Package Directive

    9. Packages and Lexicals

    10. Exercises

  3. Chapter 3 Introduction to References

    1. Performing the Same Task on Many Arrays

    2. Taking a Reference to an Array

    3. Dereferencing the Array Reference

    4. Dropping Those Braces

    5. Modifying the Array

    6. Nested Data Structures

    7. Simplifying Nested Element References with Arrows

    8. References to Hashes

    9. Exercises

  4. Chapter 4 References and Scoping

    1. More than One Reference to Data

    2. What if That Was the Name?

    3. Reference Counting and Nested Data Structures

    4. When Reference Counting Goes Bad

    5. Creating an Anonymous Array Directly

    6. Creating an Anonymous Hash

    7. Autovivification

    8. Autovivification and Hashes

    9. Exercises

  5. Chapter 5 Manipulating Complex Data Structures

    1. Using the Debugger to View Complex Data

    2. Viewing Complex Data with Data::Dumper

    3. Storing Complex Data with Storable

    4. The map and grep Operators

    5. Using map

    6. Applying a Bit of Indirection

    7. Selecting and Altering Complex Data

    8. Exercises

  6. Chapter 6 Subroutine References

    1. Referencing a Named Subroutine

    2. Anonymous Subroutines

    3. Callbacks

    4. Closures

    5. Returning a Subroutine from a Subroutine

    6. Closure Variables as Inputs

    7. Closure Variables as Static Local Variables

    8. Exercise

  7. Chapter 7 Practical Reference Tricks

    1. Review of Sorting

    2. Sorting with Indices

    3. Sorting Efficiently

    4. The Schwartzian Transform

    5. Recursively Defined Data

    6. Building Recursively Defined Data

    7. Displaying Recursively Defined Data

    8. Exercises

  8. Chapter 8 Introduction to Objects

    1. If We Could Talk to the Animals...

    2. Introducing the Method Invocation Arrow

    3. The Extra Parameter of Method Invocation

    4. Calling a Second Method to Simplify Things

    5. A Few Notes About @ISA

    6. Overriding the Methods

    7. Starting the Search from a Different Place

    8. The SUPER Way of Doing Things

    9. What to Do with @_

    10. Where We Are So Far...

    11. Exercises

  9. Chapter 9 Objects with Data

    1. A Horse Is a Horse, of Course of Course—or Is It?

    2. Invoking an Instance Method

    3. Accessing the Instance Data

    4. How to Build a Horse

    5. Inheriting the Constructor

    6. Making a Method Work with Either Classes or Instances

    7. Adding Parameters to a Method

    8. More Interesting Instances

    9. A Horse of a Different Color

    10. Getting Your Deposit Back

    11. Don't Look Inside the Box

    12. Faster Getters and Setters

    13. Getters That Double as Setters

    14. Restricting a Method to Class-Only or Instance-Only

    15. Exercise

  10. Chapter 10 Object Destruction

    1. Nested Object Destruction

    2. Beating a Dead Horse

    3. Indirect Object Notation

    4. Additional Instance Variables in Subclasses

    5. Using Class Variables

    6. Weakening the Argument

    7. Exercise

  11. Chapter 11 Some Advanced Object Topics

    1. UNIVERSAL Methods

    2. Testing Your Objects for Good Behavior

    3. AUTOLOAD as a Last Resort

    4. Using AUTOLOAD for Accessors

    5. Creating Getters and Setters More Easily

    6. Multiple Inheritance

    7. References to Filehandles

    8. Exercise

  12. Chapter 12 Using Modules

    1. Sample Function-Oriented Interface: File::Basename

    2. Selecting What to Import

    3. Sample Object-Oriented Interface: File::Spec

    4. A More Typical Object-Oriented Module: Math::BigInt

    5. The Differences Between OO and Non-OO Modules

    6. What use Is Doing

    7. Setting the Path at the Right Time

    8. Importing with Exporter

    9. @EXPORT and @EXPORT_OK

    10. Exporting in a Primarily OO Module

    11. Custom Import Routines

    12. Exercise

  13. Chapter 13 Writing a Distribution

    1. Starting with h2xs

    2. Looking at the Templates

    3. The Prototype Module Itself

    4. Embedded Documentation

    5. Controlling the Distribution with Makefile.PL

    6. Alternate Installation Locations (PREFIX=...)

    7. Trivial make test

    8. Trivial make install

    9. Trivial make dist

    10. Using the Alternate Library Location

    11. Exercise

  14. Chapter 14 Essential Testing

    1. What the Test Harness Does

    2. Writing Tests with Test::Simple

    3. Writing Tests with Test::More

    4. Conditional Tests

    5. More Complex Tests (Multiple Test Scripts)

    6. Testing Things That Write to STDOUT and STDERR

    7. Exercise

  15. Chapter 15 Contributing to CPAN

    1. The Comprehensive Perl Archive Network

    2. Getting Prepared

    3. Preparing Your Distribution

    4. Uploading Your Distribution

    5. Announcing the Module

    6. Testing on Multiple Platforms

    7. Consider Writing an Article or Giving a Talk

    8. Exercise

  1. Appendix A Answers to Exercises

    1. Answers for Chapter 2

    2. Answers for Chapter 3

    3. Answers for Chapter 4

    4. Answers for Chapter 5

    5. Answer for Chapter 6

    6. Answers for Chapter 7

    7. Answers for Chapter 8

    8. Answer for Chapter 9

    9. Answer for Chapter 10

    10. Answer for Chapter 11

    11. Answer for Chapter 12

    12. Answers for Chapters 13-15

  2. Colophon

View Full Table of Contents
Product Details
Title:
Learning Perl Objects, References, and Modules
By:
Randal L. Schwartz, Tom Phoenix
Publisher:
O'Reilly Media
Formats:
  • Print
  • Safari Books Online
Print Release:
June 2003
Pages:
224
Print ISBN:
978-0-596-00478-1
| ISBN 10:
0-596-00478-8
Customer Reviews
About the Author
  1. Tom Phoenix

    Tom Phoenix has been working in the field of education since 1982. After more than thirteen years of dissections, explosions, work with interesting animals, and high-voltage sparks during his work at a science museum, he started teaching Perl classes for Stonehenge Consulting Services, where he's worked since 1996. Since then, he has traveled to many interesting locations, so you might see him soon at a Perl Mongers' meeting. When he has time, he answers questions on Usenet's comp.lang.perl.misc and comp.lang.perl.moderated newsgroups, and contributes to the development and usefulness of Perl. Besides his work with Perl, Perl hackers, and related topics, Tom spends his time on amateur cryptography and speaking Esperanto. His home is in Portland, Oregon.

    View Tom Phoenix's full profile page.

Colophon

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.

  • Book cover of Learning Perl Objects, References, and Modules