Perl mechanism for (
multiple!)
inheritance (pronounced "
is-a", after standard
object oriented programming terminology).
An object in Perl is merely a reference that has been blessed into a package. If $a holds an object, $a->meth(arguments...) calls that object's meth method.
Assume $a was blessed into package A. Then A::meth($a, arguments...) will be called. But what if no sub A::meth exists?
Perl doesn't give up, not yet. If there's a (global) variable @A::ISA, Perl will loop over its elements and treat each one as a package name (a string). For a name parent, it will attempt to find a method meth as if $a were in fact blessed to package parent.
You can explicitly request the search (ignoring any method defined for the object in the current package) by using the "pseudoclass" SUPER and saying $a->SUPER::meth(arguments...).
The result is essentially multiple inheritance! If you start your class with the words
package MyClass;
@ISA = ('Shape', 'Storable');
then objects in
MyClass will behave like objects of types
Shape and
Storable (in that order), except when overridden by definitions in
MyClass. This being Perl, it's still up to
MyClass'
constructor "
new" to arrange for
Shape-specific and
Storable-specific
initializations to take place!
Note that this only applies to methods, not to instance variables (which Perl doesn't really have). But if $a is a hash reference of class MyClass, and if Storable uses an "instance variable" ...->{_v}, then $a->{_v} really accesses that "instance variable". But woe betide you if Shape (or MyClass) have instance variables that share this name!