Open Source Home

Open Source Articles

Open Source Links

Open Source Books

Open Source Tools

Open Source Keywords



Open Source

Learning Perl Objects, References & Modules

See more Amazon Details

Contents Listing

Foreword
Preface

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?

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

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

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

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

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

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

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

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

10. Object Destruction
Beating a Dead Horse
Indirect Object Notation
Additional Instance Variables in Subclasses
Using Class Variables
Weakening the Argument
Exercise

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

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

13. Writing a Distribution
Starting with h2xs
Looking at the Templates
The Prototype Module Itself
Embedded Documentation
Controlling the Distribution withMakefile.PL
Alternate Installation Locations (PREFIX=...)
Trivial make test
Trivial make install
Trivial make dist
Using the Alternate Library Location
Exercise

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

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. Answers to Exercises

Index

Google
Web www.opensource.force9.co.uk

Contents
View a contents listing.

Short
Short Description.


Keyword Pages

Keyword Bestsellers

Open Source Bestsellers
The bestselling books on Amazon.

Articles

Birmingham Evaluates Open-Source

MySQL and Red Hat

Bank Saving 50 percent on Sun to Linux Move

Red Hat Sales and Profit Leap

Visit our site of the month Sarbanes-Oxley at www.sarbanesoxleyuk.co.uk
Visit our site of the month Sarbanes-Oxley at www.sarbanesoxleyuk.co.uk