Basic HTML version of Foils prepared April 16,1996

Foil 31 Perl5 Object Model -- I

From Perl5 and Advanced Perl4 Features Computational Science for Information Age Course CPS616 Material -- April 16,1996. by Geoffrey C. Fox


The object model in Perl5 is not as clear as in Java as the concepts are mixed up with the implementation.
We see same flaws in JavaScript where we "violate" modular programming principles by mixing concept and implementation in the technology which is precisely designed to help programmer keep these separate in his or her own programs!
Objects are references -- not directly variables -- they are typically references returned from subroutines as anonymous datastructures
  • objects (references) must be "blessed" so they remember what class (module or package) they come from
  • bless ($self, $class); return $self; # is classic way for a constructor subroutine new to end with $self the datastructure you wish to be stored in object



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Sep 6 1997