[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Simple Explanation for @ISA?



gasster@pacificnet.net writes:
} I have read several Perl books and the man pages about
} the use of the @ISA array.  I am looking for a simple explanation
} of why you need it, and what it does.  Most of the discussions
} jump right into OOP related material and it makes understanding
} this array complicated

Having recently read the new Camel on this topic (it's a long flight
 from Tucson to Baltimore, especially when you have to change planes at
Dallas/Fort Worth), I believe I understand it.  (Although I'm not
object orientedly correct, doing most of my scientific programming in C
and FORTRAN, so my use of the terminology may not be exactly right.)
The correct pronunciation of @ISA is "is a", and it basically functions
like the @INC array.  When you "require" or "use" a file that Perl
doesn't already know about, it hunts through the directories in the
@INC array until it finds it.  Similarly, when you try to use a method
on an object that Perl doesn't already know about, it hunts through the
object's class, and then the classes named in @ISA (and also the base
classes of those, I believe) for the method until it finds it.  That
seems to be all there is to it.  You put into @ISA those classes from
which you want to inherit methods.  Kind of like @INC, but on the scale
of subroutines rather than entire files.  (Someone who knows more about
this stuff correct me if I'm wrong.)

} 
} thanks for any help...
} -sam
} -- 
} ************************************************************
} Samuel D. Gasster
} gasster@pacificnet.net
} ************************************************************
} 
---
--------
Paul J. Schinder
NASA Goddard Space Flight Center,
Code 693, Greenbelt, MD 20771 USA
schinder@pjstoaster.pg.md.us