diabelek has asked for the wisdom of the Perl Monks concerning the following question:
A little bit of an odd question. I'm experimenting with inheritance and I can get it to work as long as I set the variables in the instance of the child class since the self object that contains the variable will be passed to the parents function that I'm calling. IE the child module has the variable VERSION that I set in the new function to $self->{VERSION} = VERSION. The parent module has the method sub GetVersion() that prints the version of the module.
What I'm trying to figure out, is if there is any way to have the modules variable $VERSION accessible from a parent class without setting it in the instance? The only thing I can think of to do it is to have the parent include that module at the time I need the version but that kind seems like a hack.
Any other ideas?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Inheritance & module variables
by kyle (Abbot) on Sep 18, 2008 at 15:26 UTC | |
|
Re: Perl Inheritance & module variables
by gone2015 (Deacon) on Sep 18, 2008 at 16:30 UTC | |
by diabelek (Beadle) on Sep 19, 2008 at 16:26 UTC | |
by gone2015 (Deacon) on Sep 20, 2008 at 08:53 UTC | |
|
Re: Perl Inheritance & module variables
by brian_d_foy (Abbot) on Sep 20, 2008 at 19:41 UTC | |
|
Re: Perl Inheritance & module variables
by Anonymous Monk on Sep 19, 2008 at 09:26 UTC | |
by diabelek (Beadle) on Sep 19, 2008 at 16:04 UTC |