note
simonm
Sorry for the late reply, but I don't think [cpan://Class::MethodMaker] will do this for you.
<p> My [cpan://Class::MakeMethods] module does have something close to what you want:
<code>
use Class::MakeMethods::Template::ClassVar
'instance' => 'my_singleton',
'scalar' => 'my_static';
</code>
<p> Those methods store a value in a per-class package variable, so each subclass and its instances share a common value without influencing the superclass and other subclasses.
<p> For the static method, if you'd like the subclasses to default to sharing the superclass value and only override it in a few specific subclasses, use Template::Inheritable instead of Template::ClassVar.
<p> I haven't tested the combination of Template::ClassVar and instance; please let me know if it doesn't work as expected...
460911
460911