in reply to SUPER in OOPerl is dumped with $self

Here the question is "How the child (object) know its parent(object)" and NOT "Parent knowing the child"

In general, the answer (regardless of language) is "there is no general answer". OO is about the relationships of classes to each other, specifically "is-a" relationships in the case of inheritance. If the objects are also related (which they may or may not be), you have to set up some form of references from one to the other to create that relationship as it's not an inherent part of OO.

The example in the other thread confuses the issue because it defines a parent class (person) which is intended to represent a mother and a child class (child) which is intended to represent her son. The differences between the OO parent/child relationship ("a child is a person") and the real-world parent/child relationship ("Billy is Alice's son") make it difficult to discuss clearly.

If we take a different set of classes, say Vehicle and Truck, then it is more obvious that "a Truck is a Vehicle" without the implications that any individual truck (instance) has a parent (instance). (And, if it did, its "parent" would be either a Factory or a Person::AutoDesigner, not a Vehicle.)

Can you help us to solve this problem, other than creating instance of base classes inside our package?

I still don't see what the problem is. As I asked in the other thread, "what is it that you want to accomplish without creating instances of base classes inside your package?" If you're creating instances of the base class, then that suggests to me that you're thinking of the base class and derived class as two different things (Billy and Alice, in the original example) and, if that's the case, then they should be instantiated as two separate objects rather than trying to trick one object into doing double duty.

  • Comment on Re: SUPER in OOPerl is dumped with $self