Object Oriented Perl
Damian Conway
Foreword by Randal L. Schwartz
  • August 1999
  • ISBN 9781884777790
  • 512 pages

Object Oriented Perl is designed to provide anyone who is familiar with the basics of regular Perl programming with a complete introduction to the object-oriented features of Perl. The book moves from the very simplest applications through advanced applications such as generic programming, multiple dispatch, and object-oriented persistence. Thus, it offers a much-needed resource for persons new to Perl, as well as new and valuable insights and techniques for even the most accomplished Perl programmers.

About the book

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.

Translation rights for Object Oriented Perl have been granted for Korea, Japan, India, and Germany. If you are interested in learning where to buy this book in a language other than English, please inquire at your local bookseller.

Table of Contents detailed table of contents




author online

1. What you need to know first (an object-orientation primer)

1.1. The essentials of object orientation

1.2. Other object-oriented concepts

1.3. Terminology: a few (too many) words

1.4. Where to find out more

1.5. Summary

2. What you need to know second (a Perl refresher)

2.1. Essential Perl

2.2. Non-essential (but very useful) Perl

2.3. The CPAN

2.4. Where to find out more

2.5. Summary

3. Getting started

3.1. Three little rules

3.2. A simple Perl class

3.3. Making life easier

3.4. The creation and destruction of objects

3.5. The CD::Music class, compleat

3.6. Summary

4. Blessing arrays and scalars

4.1. What’s wrong with a hash?

4.2. Blessing an array

4.3. Blessing a pseudo-hash

4.4. Blessing a scalar

4.5. Summary

5. Blessing other things

5.1. Blessing a regular expression

5.2. Blessing a subroutine

5.3. Blessing a typeglob

5.4. Summary

6. Inheritance

6.1. How Perl handles inheritance

6.2. Tricks and traps

6.3. Example: Inheriting the CD class

6.4. Where to find out more

6.5. Summary

7. Polymorphism

7.1. Polymorphism in Perl

7.2. Example: Polymorphic methods for the Lexer class

7.3. The simple pretty-printer objectified

7.4. Using interface polymorphism instead

7.5. Where to find out more

7.6. Summary

8. Automating class creation

8.1. The Class::Struct module

8.2. The Class::MethodMaker module

8.3. Where to find out more

8.4. Summary

9. Ties

9.1. A jacketing tie required

9.2. Tie-ing a scalar

9.3. Tie-ing a hash

9.4. Tie-ing an array

9.5. Tie-ing a filehandle

9.6. Inheriting from a tie’able package

9.7. Tied variables as objects

9.8. Where to find out more

9.9. Summary

10. Operator overloading

10.1. The problem

10.2. Perl’s operator overloading mechanism

10.3. Example: A Roman numerals class

10.4. Circumventing undesired reference semantics

10.5. The use and abuse of operators

10.6. Where to find out more

10.7. Summary

11. Encapsulation

11.1. The perils of trust

11.2. Encapsulation via closures

11.3. Encapsulation via scalars

11.4. Encapsulation via ties

11.5. Where to find out more

11.6. Summary

12. Genericity

12.1. Why Perl doesn’t need special generic mechanisms

12.2. Using specific mechanisms anyway

12.3. Implicit generics via polymorphism

12.4. Where to find out more

12.5. Summary

13. Multiple dispatch

13.1. What is multiple dispatch?

13.2. Multiple dispatch via single dispatch and cases

13.3. Multiple dispatch via a table

13.4. Comparing the two approaches

13.5. Dynamic dispatch tables

13.6. Some lingering difficulties

13.7. The Class::Multimethods module

13.8. Comparing the three approaches

13.9. Where to find out more

13.10. Summary

14. Persistent objects

14.1. The ingredients

14.2. Object-oriented persistence

14.3. Coarse-grained persistence

14.4. Fine-grained persistence

14.5. Where to find out more

14.6. Summary

Appendix A: Quick reference guide

Appendix B: What you might know instead

B.1. Perl and Smalltalk

B.2. Perl and C++

B.3. Perl and Java

B.4. Perl and Eiffel




About the author

Damian Conway holds a Ph.D. in Computer Science and is currently a Senior Lecturer in Computer Science and Software Engineering at Monash University in Melbourne, Australia. He has written numerous technical and scientific papers, as well as a textbook on advanced object-oriented techniques in C++. He is the author of numerous popular Perl modules, including: Parse::RecDescent, Text::Balanced, Getopt::Declare, Lingua::EN::Inflect, Tie::SecureHash, and Class::Multimethod (available from your local CPAN mirror).

Damian is one of the most active members of the Perl community and was named the recipient of the first ever YAS Perl DevelopmentGrant awarded by Yet Another Society, which allowed him to devote an entire year to writing and lecturing on Perl and working on related projects. He is a highly sought presenter at Perl conferences, is a contributor to the Perl Journal and is the three-time winner of the annual Larry Wall award for Practical Utility.

placing your order...

Don't refresh or navigate away from the page.
print book $42.95 pBook + PDF
Additional shipping charges may apply
Object Oriented Perl (print book) added to cart
continue shopping
go to cart

eBook $21.50 PDF only
Object Oriented Perl (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks