4.4. A Quick Introduction To Object-Oriented Programming

There is no way to avoid it—we have to talk about object-oriented programming (OOP) using Perl. Object-oriented programming is not a big deal though; it is just a way to give an object (a thing) actions (behaviors, also known as methods). Let’s say we have an object named $car. We can drive the car by executing that object’s drive() method, using the nifty arrow notation: $car->drive(). Easy, eh? Well, of course it is not so easy, so we suggest that if you want an excellent discussion of all things OOP in Perl, see Objected-Oriented Perl [Conway 99].

Most of the time, when we do OOP in Perl, we will use objects that others have defined. In Chapter 7, when we learn how to do CGI programming ...

Get Open Source Web Development with LAMP: Using Linux, Apache, MySQL, Perl, and PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.