> I guess by extension you mean that you are trying to subclass
> a module. In that case you would need to inherit from that
Yeah I guess that is the term.
> parent class with something like:
>
> our @ISA = qw(ParentClass)
>
> or
>
> use base qw(ParentClass)
>
> Then you can call the methods of the parent class on the
> instances of this subclass.
Thanks Sharad for the info.
That didn't work, but changing my package like so :
sub function {}
To
sub ParentClass::function {}
Worked perfect.
The problem is now:
Is it kosher to mess with the ParentClass's name space like
that (only if imported by the script of course) or is that
the only to acomplish that?
(short of creating a ParentName::MyModule object, which
seems like just an extra step in this case or doing the
ParentName::MyModule::function($obj,$arg) method or
function($obj,$arg) if imported in use statement)
Basically I use the ParentName's $obj inside my functions
and they are expecting it as the first arg.
$obj->MyModule::function($arg); would be the coolest way
(leaving my functions as sub function instead of sub
NameSpace::Evil::function)
Is this possible or am I just batty!?
TIA
Dan
>
> -Sharad
>
> > -----Original Message-----
> > From: Dan Muey [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, October 29, 2003 9:56 AM
> > To: [EMAIL PROTECTED]
> > Subject: Module Object and sub module function
> >
> >
> > 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 ??
> >
> > TIA
> >
> > Dan
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]