Linux Today: Linux News On Internet Time.

Linux Magazine: An Object Lesson in Perl

Jul 03, 2000, 23:58 (0 Talkback[s])
(Other stories by Randal L. Schwartz)

"In the past three columns, I looked at using "references" in Perl. References are an important part of capturing and reflecting the structure of real-world data -- for example, a table of employees, each of whom has various attributes, can be represented as an array of hashrefs, pointing at attribute hashes for each employee."

"Now let's turn to capturing and reflecting real-world processes, in the form of "objects." Objects provide encapsulation (to control access to data), abstract data types (to let the data more closely model the real world), and inheritance (to reuse operations that are similar but have some variation)."

"The Perl distribution includes perlobj, a basic reference in using objects, and perltoot, which introduces readers to the peculiarities of Perl's object system in a tutorial way. However, I found that both of these documentation sections tend to be opaque to those of us with less experience with objects. And that seems to be the majority of users coming from a system-administration or CGI Web-development background (Perl's core audience)."

Complete Story

Related Stories: