You can change your inheritance tree. File::Spec does this. Whether it's a good idea or not is another story.
The problem with changing your inheritance tree is that it affects all objects of that type, or that are derived from that type. For File::Spec, being that it can't be recast as a different platform, this seems ok. For you, this may be a show-stopper.
How I would do this in C++ would be to create a proxy object, a factory to create them, and then call through the proxy for everything. So your Tk::MyEntryCheck object would contain another object in it through a HASA relationship (rather than the ISA relationship you're trying to do). And then you could just replace that object at runtime with a different object that did different things. The advantage is that you can have multiple Tk::MyEntryCheck objects, each of which have different proxy objects that are unrelated to each other, and it can all work.
Another way is to create a new package, set it so it ISA Tk::MyEntryCheck, and put the code in there. In other words, reverse the inheritance tree from what you're trying to do. The problem here is trying to ensure that you can fully swap out one entry-check object with another which sometimes can be more difficult, but, if it can be done, it may be less code than the HASA method above.
In reply to Re: Userdefined Tk::Derived parent for Widget-Addon
by Tanktalus
in thread Userdefined Tk::Derived parent for Widget-Addon
by strat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |