Appendix G. User’s View of Object-Oriented Modules

The following article by Sean M. Burke first appeared in The Perl Journal #17 and is copyright 2000, The Perl Journal. It appears courtesy of Jon Orwant and The Perl Journal. This document may be distributed under the same terms as Perl itself.

A User’s View of Object-Oriented Modules

The first time that most Perl programmers run into object-oriented programming is when they need to use a module whose interface is object-oriented. This is often a mystifying experience, since talk of “methods” and “constructors” is unintelligible to programmers who thought that functions and variables was all there was to worry about.

Articles and books that explain object-oriented programming (OOP), do so in terms of how to program that way. That’s understandable, and if you learn to write object-oriented code of your own, you’d find it easy to use object-oriented code that others write. But this approach is the long way around for people whose immediate goal is just to use existing object-oriented modules, but who don’t yet want to know all the gory details of having to write such modules for themselves.

This article is for those programmers—programmers who want to know about objects from the perspective of using object-oriented modules.

Modules and Their Functional Interfaces

Modules are the main way that Perl provides for bundling up code for later use by yourself or others. As I’m sure you can’t help noticing from reading The Perl Journal, CPAN (the ...

Get Perl & LWP 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.