| foreword |
|
xi | |
| preface |
|
xii | |
| acknowledgments |
|
xviii | |
| author online |
|
xx | |
|
What you need to know first (an object-orientation primer) |
|
|
1 | (20) |
|
The essentials of object orientation |
|
|
2 | (11) |
|
Other object-oriented concepts |
|
|
13 | (5) |
|
Terminology: a few (too many) words |
|
|
18 | (1) |
|
|
|
18 | (2) |
|
|
|
20 | (1) |
|
What you need to know second (a Perl refresher) |
|
|
21 | (52) |
|
|
|
21 | (30) |
|
Non-essential (but very useful) Perl |
|
|
51 | (14) |
|
|
|
65 | (3) |
|
|
|
68 | (4) |
|
|
|
72 | (1) |
|
|
|
73 | (45) |
|
|
|
73 | (7) |
|
|
|
80 | (9) |
|
|
|
89 | (7) |
|
The creation and destruction of objects |
|
|
96 | (18) |
|
The CD::Music class, compleat |
|
|
114 | (3) |
|
|
|
117 | (1) |
|
Blessing arrays and scalars |
|
|
118 | (25) |
|
What's wrong with a hash? |
|
|
118 | (1) |
|
|
|
119 | (7) |
|
|
|
126 | (9) |
|
|
|
135 | (7) |
|
|
|
142 | (1) |
|
|
|
143 | (25) |
|
Blessing a regular expression |
|
|
143 | (8) |
|
|
|
151 | (7) |
|
|
|
158 | (8) |
|
|
|
166 | (2) |
|
|
|
168 | (35) |
|
How Perl handles inheritance |
|
|
168 | (10) |
|
|
|
178 | (15) |
|
Example: Inheriting the CD class |
|
|
193 | (8) |
|
|
|
201 | (1) |
|
|
|
202 | (1) |
|
|
|
203 | (10) |
|
|
|
203 | (2) |
|
Example: Polymorphic methods for the Lexer class |
|
|
205 | (3) |
|
The simple pretty-printer objectified |
|
|
208 | (2) |
|
Using interface polymorphism instead |
|
|
210 | (2) |
|
|
|
212 | (1) |
|
|
|
212 | (1) |
|
Automating class creation |
|
|
213 | (23) |
|
|
|
213 | (9) |
|
The Class::MethodMaker module |
|
|
222 | (12) |
|
|
|
234 | (1) |
|
|
|
235 | (1) |
|
|
|
236 | (40) |
|
|
|
236 | (2) |
|
|
|
238 | (5) |
|
|
|
243 | (6) |
|
|
|
249 | (7) |
|
|
|
256 | (6) |
|
Inheriting from a tie'able package |
|
|
262 | (3) |
|
Tied variables as objects |
|
|
265 | (9) |
|
|
|
274 | (1) |
|
|
|
275 | (1) |
|
|
|
276 | (20) |
|
|
|
276 | (2) |
|
Perl's operator overloading mechanism |
|
|
278 | (6) |
|
Example: A Roman numerals class |
|
|
284 | (7) |
|
Circumventing undesired reference semantics |
|
|
291 | (1) |
|
The use and abuse of operators |
|
|
292 | (3) |
|
|
|
295 | (1) |
|
|
|
295 | (1) |
|
|
|
296 | (31) |
|
|
|
296 | (1) |
|
Encapsulation via closures |
|
|
297 | (5) |
|
Encapsulation via scalars |
|
|
302 | (7) |
|
|
|
309 | (17) |
|
|
|
326 | (1) |
|
|
|
326 | (1) |
|
|
|
327 | (24) |
|
Why Perl doesn't need special generic mechanisms |
|
|
327 | (2) |
|
Using specific mechanisms anyway |
|
|
329 | (7) |
|
Implicit generics via polymorphism |
|
|
336 | (14) |
|
|
|
350 | (1) |
|
|
|
350 | (1) |
|
|
|
351 | (36) |
|
What is multiple dispatch? |
|
|
351 | (2) |
|
Multiple dispatch via single dispatch and cases |
|
|
353 | (3) |
|
Multiple dispatch via a table |
|
|
356 | (5) |
|
Comparing the two approaches |
|
|
361 | (2) |
|
|
|
363 | (4) |
|
Some lingering difficulties |
|
|
367 | (1) |
|
The Class::Multimethods module |
|
|
367 | (18) |
|
Comparing the three approaches |
|
|
385 | (1) |
|
|
|
385 | (1) |
|
|
|
385 | (2) |
|
|
|
387 | (42) |
|
|
|
387 | (11) |
|
Object-oriented persistence |
|
|
398 | (2) |
|
Coarse-grained persistence |
|
|
400 | (12) |
|
|
|
412 | (15) |
|
|
|
427 | (1) |
|
|
|
428 | (1) |
| A Quick reference guide |
|
429 | (9) |
| B What you might know instead |
|
438 | (21) |
|
|
|
438 | (5) |
|
|
|
443 | (6) |
|
|
|
449 | (5) |
|
|
|
454 | (5) |
| glossary |
|
459 | (7) |
| bibliography |
|
466 | (2) |
| index |
|
468 | |