Object Oriented Perl
WHAT YOU WILL LEARN IN THIS CHAPTER:
- Understanding what an object is
- Learning the three rules of Perl’s OO system
- Creating a class
- How to subclass a class
- Overloading classes
- Learning OO traps for the unwary
WROX.COM CODE DOWNLOAD FOR THIS CHAPTER
The wrox.com code downloads for this chapter are found at http://www.wrox.com/remtitle.cgi?isbn=1118013847 on the Download Code tab. The code for this chapter is divided into the following major examples:
Chapter 10 mentioned that knowledge of the sort, map, and grep functions is sort of a litmus test that some programmers use to know if a Perl developer is at least at an intermediate level. Knowledge of object-oriented programming (often referred to as OOP, or just OO) is your first step toward being an advanced Perl developer. Many languages support OO programming, and learning about it in Perl will help you in many other languages.
Two chapters discuss OOP. This chapter describes Perl’s built-in OO tools. They’re minimal, but this minimalism gives you a lot of freedom. You need to understand how Perl’s built-in OO works because much of the Perl software in the wild is written with this.
The next chapter, Chapter 13, covers Moose which is an incredibly powerful object system built on top of Perl’s OO tools. ...