Keep It Simple, Stupid | |
PerlMonks |
Can you override lexically scoped variables when sub-classing a module.by learnedbyerror (Monk) |
on Oct 11, 2012 at 18:45 UTC ( [id://998513]=perlquestion: print w/replies, xml ) | Need Help?? |
learnedbyerror has asked for the wisdom of the Perl Monks concerning the following question: Oh Monks, I am in need of your assistance again. I am trying to sub-class a module that makes of a lexical (my) variable set at the package level. I need to change the change the value of this variable in my module; however, I cannot figure out how to do this. The following code is representative of the other module and what I would like to do.
My desired approach - which won't work as shown - is something like this:
An example of using these modules is:
With the desired output being:
Any assistance in figuring out a way around this conundrum short of modifying the first module would be greatly appreciated. Having said that, I am trying to to get the first module modified to include constructors for changing this variable. As always, thanks in advance for your assistance! lbe
Back to
Seekers of Perl Wisdom
|
|