Foreword
Perl's object-oriented mechanism is classic
prestidigitation. It takes a collection of Perl's
existing non-OO features such as packages, references, hashes,
arrays, subroutines, and modules, and then—with nothing up its
sleeve—manages to conjure up fully functional objects, classes,
and methods. Seemingly out of nowhere.
That's a great trick. It means you can build on your
existing Perl knowledge and ease your way into OO Perl development,
without first needing to conquer a mountain of new syntax or navigate
an ocean of new techniques. It also means you can progressively
fine-tune OO Perl to meet your own needs, by selecting from the
existing constructs the one that best suits your task.
But there's a problem. Since Perl co-opts packages,
references, hashes, arrays, subroutines, and modules as the basis of
its OO mechanism, to use OO Perl you already need to understand
packages, references, hashes, arrays, subroutines, and modules.
And there's the rub. The learning curve
hasn't been eliminated; it's merely
been pushed back half a dozen steps.
So then: how are you going to learn everything you need to know about
non-OO Perl so you can start to learn everything you need to know
about OO Perl?
This book is the answer. In the following pages, Randal draws on two
decades of using Perl, and four decades of watching
Gilligan's Island and
Mr. Ed, to explain each of the components of
Perl that collectively underpin its OO features. And, better still,
he then goes on to show exactly how to combine those components to
create useful classes and objects.
So if you still feel like Gilligan when it comes to
Perl's objects, references, and modules, this book
is just what the Professor ordered.
And that's straight from the
horse's mouth.
—Damian Conway, May 2003
|