Résumé
Beyond explaining the syntax and semantics of Perl's inbuilt object-oriented features, Object Oriented Perl explains how to apply those features in a wide range of programming techniques. Each technique is illustrated with complete examples.
Object Oriented Perl also discusses the latest relevant Perl modules, which are freely available and can greatly simplify object-oriented development in Perl. In particular, it examines the new standard "fields" module and the associated pseudo-hash construct.
No other book covers the topic of object-oriented software development in Perl in such breadth, to such depth, or in such a readable manner. Complete source code for Object Oriented Perl will be available on-line.
Table of contents
- Introduction
- What is this book about?
- What is object-oriented Perl?
- Whom this book is for?
- Where to find what you're looking for?
- What You Need To Know First (An OO Primer)
- The essential elements of OO
- Abstraction
- Encapsulation
- Inheritance
- Polymorphism
- Other OO concepts
- Genericity
- Interface vs implementation
- Class vs type
- Persistence
- A few words about terminology
- Where to find out more
- The essential elements of OO
- What You Need To Know Second (A Perl Refresher)
- Essential Perl
- Scalars
- Arrays
- Hashes
- Subroutines
- References
- Packages
- Non-essential (but very useful) Perl
- Modules
- Autoloading
- Closures
- Typeglobs
- Where to find out more
- Books
- The Perl documentation
- The Perl Journal
- Perl on the WWW
- Newsgroups
- Essential Perl
- Simple Object-Oriented Perl
- Three little rules
- Rule 1: To create a class, build a package
- Rule 2: To create a method, write a subroutine
- Rule 3: To create an object, bless a referent
- A simple Perl class
- The code
- Using the CD::Music class
- Making life easier
- Class modules
- use strict and the -w flag
- Automating data member access
- Documenting a class
- Creation and destruction of objects
- Constructors
- Destructors
- The CD::Music class, compleat
- Three little rules
- Blessing Variables
- What's wrong with a hash?
- Blessing an array
- Reimplementing CD::Music
- An array-specific example - iterators
- Where to find out more
- Blessing a pseudo-hash
- A pseudo-what???
- Limitations of a pseudo-hash
- Advantages of a pseudo-hash
- The worst of both worlds?
- Compile-time support for run-time performance
- Just how Perl knows at compile-time that a particular variable is referring to a Transponder object, when the variable isn't assigned a value until run-time
- Yet another version of CD::Music
- Where to find out more
- Blessing a scalar
- Why not bless a scalar?
- An object-oriented password
- A bit-string class
- Where to find out more
- Blessing Other Things
- Blessing a regular expression
- The qr operator
- Why an OO regular expression class?
- Designing a different regular expressions mechanism
- A closer look at the two classes
- On the separation of Search and State
- Where to find out more
- Blessing a subroutine
- So how can a subroutine be an object?
- Why objectify a subroutine?
- A lexer object
- Example: A simple pretty-printer
- Where to find out more
- Blessing a typeglob
- Paging STDOUT
- A multiprocess pager class
- A threaded pager class
- Where to find out more
- Blessing a regular expression
- Inheritance
- How Perl handles inheritance
- The @ISA array
- What inheritance means in Perl
- Where the call goes
- Constructors and inheritance
- Destructors and inheritance
- Tricks and Traps
- Naming attributes of derived classes
- The isa() subroutine
- The can() subroutine
- The UNIVERSAL package
- The SUPER pseudo-package
- Inheritance and pseudo-hashes
- Issues related to accessing class data
- Example: Inheriting the CD class
- Applied laziness
- Class attributes revisited
- An alternative solution
- How Perl handles inheritance
- Polymorphism
- Polymorphism in Perl
- Example: Polymorphic methods for the Lexer class
- The simple pretty-printer objectified
- Using interface polymorphism instead
- Automating class creation
- The Class::Struct module
- The Class::MethodMaker module
- Operator Overloading
- The problem
- Perl's operator overloading mechanism
- "Automagic" operators
- Fallback operations
- Specifying conversion operators
- Example: A Roman numerals class
- Creating class constants
- Circumventing undesired reference semantics
- The use and abuse of operators
- When to overload
- Where to find out more
- Ties
- Tie'ing a scalar
- Tie'ing an array
- Tie'ing a hash
- Tie'ing a filehandle
- Blessing and tie'ing to the same package
- Encapsulation
- The perils of trust
- Enforcing encapsulation via closures
- Enforcing encapsulation via scalars
- The Tie::SecureHash module
- A limited-access hash
- Constructing a securehash
- Declaring securehash entries
- Accessing securehash entries
- Iterating a securehash
- Ambiguous keys in a securehash
- The formal access rules
- Where to find out more
- Where to find out more
- Genericity
- Why Perl doesn't need special generic mechanisms
- Using special mechanisms anyway
- Implicit generics via polymorphism
- Multiple Dispatch
- What is multiple dispatch?
- Implementing multiple dispatch via single dispatch
- Implementing multiple disatch via a table
- The Class::Multimethods module
- The problem(s)
- Automating multimethods
- Finding the "nearest" multimethod
- Implications of the multimethod dispatch process
- Defining multimethods outside their classes
- Multimethods as regular subroutines
- Non-class types as parameters
- A final refinement - recursive multiple dispatch
- Where to find out more
- Where to find out more
- Persistent Objects
- The ingredients
- Identity
- Encoding/serialization
- Storage
- Coordination
- Object-oriented persistence
- Encoding objects
- Object-oriented encoding
- Coarse-grained persistence
- Class-specific persistence
- Some improvements
- Coarse-grained persistence for any data
- Summing up
- Fine-grained persistence
- Files as objects
- Memory-mapped files as objects
- Tied databases as objects
- Fine-grained persistence for any class
- Better persistence through genericity
- Summing up
- Where to find out more
Appendix B - What You Might Know Instead- From Smalltalk to Perl
- From C++ to Perl
- From Java to Perl
- From Eiffel to Perl
Glossary
Bibliography
Index - The ingredients
L'auteur - Randal L. Schwartz
Randal L. Schwartz is a two-decade veteran of the software industry. He is skilled in software design, system administration, security, technical writing, and training. Randal has coauthored the "must-have" standards: Programming Perl, Learning Perl, Learning Perl for Win32 Systems, and Effective Perl Learning, and is a regular columnist for WebTechniques, PerformanceComputing, SysAdmin, and Linux magazines.
He is also a frequent contributor to the Perl newsgroups, and has moderated comp.lang.perl.announce since its inception. His offbeat humor and technical mastery have reached legendary proportions worldwide (but he probably started some of those legends himself). Randal's desire to give back to the Perl community inspired him to help create and provide initial funding for The Perl Institute. He is also a founding board member of the Perl Mongers (perl.org), the worldwide Perl grassroots advocacy organization. Since 1985, Randal has owned and operated Stonehenge Consulting Services, Inc. Randal can be reached for comment at merlyn@stonehenge.com or (503) 777-0095, and welcomes questions on Perl and other related topics.
L'auteur - Damian Conway
Damian Conway, surnommé le Monty Python de l'Open Source, est une figure majeure de la communauté Perl. Professeur, formateur, brillant orateur, il a écrit de nombreux modules Perl et a, entre autres, collaboré à Perl Journal. Damian a également été lauréat du prix Larry Wall en 1998 et 1999.
Caractéristiques techniques
PAPIER | |
Éditeur(s) | Manning Publications |
Auteur(s) | Randal L. Schwartz, Damian Conway |
Parution | 15/09/1999 |
Nb. de pages | 490 |
Format | 18,8 x 23,5 |
Poids | 850g |
EAN13 | 9781884777790 |
ISBN13 | 978-1-884777-79-0 |
Avantages Eyrolles.com
Consultez aussi
- Les meilleures ventes en Graphisme & Photo
- Les meilleures ventes en Informatique
- Les meilleures ventes en Construction
- Les meilleures ventes en Entreprise & Droit
- Les meilleures ventes en Sciences
- Les meilleures ventes en Littérature
- Les meilleures ventes en Arts & Loisirs
- Les meilleures ventes en Vie pratique
- Les meilleures ventes en Voyage et Tourisme
- Les meilleures ventes en BD et Jeunesse