Dan Muey wrote:

> Howdy folks,
>
> Yet another module question.
>
> I'm so close and I've done this but I can't get it to work.
>
> I am writing a module that is an extension/sub module of an existing module.
>
> use ... MyNewSexxySubModule qw(function);
>
> $obj = new->Original::Package();
> for(Original::Package::MyNewSexxySubModule::function($obj,$arg)) { ....
>
> This works like a charm but what I'd really like to do is this:
>
> Use lib '/home/me/modules/';
> use MyNewSexxySubModule qw(function); # package 
> Original::Package::MyNewSexxySubModule;
>
> $obj = new->Original::Package();
> for($obj->function($arg)) { ....
>
> When I try that it says:
> Original::Package=GLOB(0x829da00) is an [unexpected] object, aborting at 
> ./ModTest.pl line 21
> Line 21 is my for($obj->....
>
> Any ideas what I'm missing ??

Hi Dan,

It sounds like you have a concept of the purpose of inheritance, but some of it 
backward, and
some of that magic is irrelevant to Perl, since Perl lacks types.  The ISA 
relationship means
that you can store objects of various subtypes in a cntainer declared for their 
supertype, for
instance.  Doesn't matter much in Perl, since containers can hold scalars of any type 
anyway.

The other advantage of inheritance, and a very relevant one, is the ability to access 
*methods of
base types* through anobject declared as a subtype.  The important point is that ISA 
[pronounced
always "izza'"] izza one-way relationship in most cases.  Anytime you slip behind the 
wheel of a
Lamborghini, you are getting into an automobile.  Don't you just wish the converse 
were true?
No, you can't buy a Pinto and do 165 mph down Main St.  That method simply isn't 
available in an
object of the generic Automobile class.

Joseph



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to