Object Oriented Perl

Peter Kitson

ISBN : 1884777791

Order a printed copy of this book from Amazon.


Cover Design - Object Oriented Perl
 

For your free electronic copy of this book please verify the numbers below. 

(We need to do this to make sure you're a person and not a malicious script)

Numbers

 




Sample Chapter From Object Oriented Perl
     Copyright © Manning Publications



What is object-oriented Perl?


Object-oriented Perl is a small amount of additional syntax and semantics, added to the

existing imperative features of the Perl programming language. Those extras allow regular
Perl packages, variables, and subroutines to behave like classes, objects, and methods.

It\'s also a small number of special variables, packages and modules, and a large number
of new techniques, that together provide inheritance, data encapsulation, operator
overloading, automated definition of commonly used methods, generic programming,
multiply-dispatched polymorphism, and persistence.

It\'s an idiosyncratic, no-nonsense, demystified approach to object-oriented
programming, with a typically Perlish disregard for accepted rules and conventions. It
draws inspiration (and sometimes syntax) from many different object-oriented predecessors,
adapting their ideas to its own needs. It reuses and extends the functionality of existing Perl
features, and in the process throws an entirely new slant on what they mean.

In other words, it\'s everything that regular Perl is, only object-oriented.

Using Perl makes object-oriented programming more enjoyable, and using objectoriented
programming makes Perl more enjoyable too. Life is too short to endure the
cultured bondage-and-discipline of Eiffel programming, or to wrestle the alligators that lurk
in the muddy semantics of C++. Object-oriented Perl gives you all the power of those
languages, with very few of their tribulations. And best of all, like regular Perl, it\'s fun!

The essentials of object orientation

You really need to remember only five things to understand 90% of the theory of object
orientation:

• an object is anything that provides a way to locate, access, modify, and secure data;
• a class is a description of what data is accessible through a particular kind of object, and
how that data may be accessed;
• a method is the means by which an object\'s data is accessed, modified, or processed;
• inheritance is the way in which existing classes of object can be upgraded to provide
additional data or methods;
• polymorphism is the way that distinct objects can respond differently to the same
message, depending on the class they belong to;

This section discusses each of these ideas.