in reply to Re^2: OO manner of accessing static variables in a subclass?
in thread OO manner of accessing static variables in a subclass?
I'd like a way for the user to retrieve the versions
This can be done pretty simply. If we use the modules as kcott has written them, then a script could access Monks::Data and output its version like this:
use Monks::Data; print $Monks::Data::VERSION;
There's no real harm in adding a version() method to your module but neither is there any real benefit unless you are inheriting from a superclass and want an easy way for multiple levels of inherited classes all to report the same version, or at least refer to the parent/grandparent version somehow. I'm struggling to think of a use case like this; there probably is one somewhere but it would be a fairly rare occurrence.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: OO manner of accessing static variables in a subclass?
by HipDeep (Acolyte) on Aug 10, 2016 at 19:15 UTC | |
by Mr. Muskrat (Canon) on Aug 10, 2016 at 19:57 UTC | |
by choroba (Cardinal) on Aug 10, 2016 at 20:01 UTC | |
by HipDeep (Acolyte) on Aug 10, 2016 at 21:28 UTC |