Object-InsideOut - Re: Getting a foreign class pushed onto the @ISA array

Posted on Tue Jan 31 13:07:36 2006 by berkan in response to 1724 (See the whole thread of 7)
Re: Getting a foreign class pushed onto the @ISA array
What about the foreign class's object methods? IMHO, the @ISA array is central to how inheritance works. If the class name is not in the @ISA array, I worry that IOC won't be able to inherit the PVC's methods.

hi earl,

i hope jerry doesn't mind me answering [i've been looking into the OIO code and may as well share].

just after the section you've quoted, the documentation says:

$self->inherit($obj, ...);

To use object methods from foreign classes, an object must inherit from an object of that class. This would normally be done inside a class's :Init subroutine [...]
sub init :Init { my ($self, $args) = @_; my $foreign_obj = Foreign::Class->new(...); $self->inherit($foreign_obj); }


All such inherit'ed foreign objects are put into a heritage array, which the OIO AUTOLOAD function [called for a method that your inherit'ing class doesn't know how to handle] walks through to find an object that it can delegate the method to.

hope this helps,

berkan
Direct Responses: 1727 | Write a response