This is an HTML rendering of a working paper draft that led to a publication. The publication should always be cited in preference to this draft using the following reference:
  • Diomidis Spinellis. Book review: Object oriented Perl. ACM Computing Reviews, December 1999. Green Open Access

The document's metadata is available in BibTeX format.

Find the publication on Google Scholar

This material is presented to ensure timely dissemination of scholarly and technical work. Copyright and all rights therein are retained by authors or by other copyright holders. All persons copying this information are expected to adhere to the terms and constraints invoked by each author's copyright. In most cases, these works may not be reposted without the explicit permission of the copyright holder.

Diomidis Spinellis Publications

Copyright © 1999 by the Association for Computing Machinery, Inc. Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, to republish, to post on servers, or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from Publications Dept, ACM Inc., fax +1 (212) 869-0481, or

Book review: Object Oriented Perl

Diomidis Spinellis
University of the Aegean

Conway, Damian
Object Oriented Perl
Manning Publications Co., Greenwich, CT, 2000.
490 pp. $42.95, ISBN 1-884777-79-1

Documentation on the Perl programming language has come a long way since the days where the only available reference was the Perl manual page that came bundled with the system's source code. "Object Oriented Perl" stands out among the plethora of books targeting the Perl audience for its in-depth treatment of an important part of the Perl language. Many Perl programs are small, unreadable, throw-away scripts that sometimes evolve into monstrous examples of how not to program. The aim of Conway's book is to introduce the object-oriented features of Perl and detail how these can be used to organize larger programs.

The book's first two chapters set the scene by providing a clear and concise introduction to the concepts and terminology of object orientation and advanced aspects of Perl programming. A number of often poorly understood features of Perl like references, closures, and typeglobs are clearly explained. Perl's approach to object orientation is minimalistic and idiosyncratic: general-purpose features of the language (packages and subroutines) are used to implement classes and methods, while a single build-in function called "bless" is used to convert any value into an object by associating it with a given package. Chapter 3 describes this approach providing guidelines and examples for the Perl idioms that can be used to implement members, constructors, destructors, and encapsulation. Chapter 4 details alternative, more efficient, implementation strategies for objects, while chapter 5 explains how regular expressions, subroutines, and filehandles can be packaged as objects. Chapters 6 and 7 outline how Perl handles inheritance and polymorphism. Support for many object oriented features needs to be hand-coded in Perl. Chapter 8 describes modules that can be used to automate this process.

The Perl language provides the unusual facility to define the semantics of the built-in data types, through the notion of "ties" which are the subject of chapter 9. Operator overloading is detailed in chapter 10. The encapsulation mechanisms proposed in chapter 3 depend on the cooperation of the users of a class; chapter 11 provides a number of techniques for strictly enforcing encapsulation. Perl's dynamic typing of variables and interface polymorphism handle most situations in which other languages would employ genericity. For the few cases where generic programming is truly needed, chapter 12 explains how closures with lexical variables and run-time evaluation can be used to achieve the desired effects. In a similar spirit, chapter 13 details how multiple dispatch polymorphism can be simulated in Perl. The book's final chapter, 14, deals with persistence providing methods to automate the serialization of hierarchical data structures and their subsequent storage into flat files or databases, as well as ways to integrate persistence as an orthogonal aspect of a variable's definition.

Appendix A of the book provides representative code snippets for the concepts described in every chapter, while appendix B compares the object oriented features of Perl with those of Smalltalk, C++, Java and Eiffel. A glossary, a bibliography list, and a detailed index complement the book's offerings. Conway has obviously expended effort into distilling references to the most useful material, eschewing the trap of the all-inclusive lists of limited practical value. The 29 books listed in the bibliography section should be on the bookshelf of anyone seriously interested in object oriented programming and Perl. The "where to find out more" sections at the end of every chapter are written in a similar spirit containing pointers to pertinent material.

The book's organization is clear enabling the book to be used both as a tutorial and as a reference source. All chapters start with a discussion detailing the motivation behind a given feature and finish with a concise yet readable summary of the ideas introduced. The subject's treatment is appropriate for readers who are already somewhat familiar with object orientation and Perl. A number of examples provide concrete cases where the concepts described are used in practice, while diagrams are usefully employed to clarify difficult data structures. Conway focuses more on Perl object oriented techniques than on their application in large system development efforts. Given the topic's breadth a separate book is probably needed to focus on how object oriented Perl can be effectively used for programming in the large. For the time being, "Object Oriented Perl" should be required reading for all sophisticated Perl programmers.