|Think about Loose Coupling|
find the package name of an inherited object from inside the parentby tomgracey (Beadle)
|on Jul 07, 2013 at 08:19 UTC||Need Help??|
tomgracey has asked for the
wisdom of the Perl Monks concerning the following question:
I am sure this is a really simple question but cant figure out how to search for it (I'm not the sharpest stick in the box with Perl anyway tbh). This is a general Perl question, but I am using Moose so a Moose solution would be ok. Suppose I have 2 classes:
Now if I do
I get Parent not Child. (At least this is what seems to happen from my experimentation. Unless I am doing something wrong!)
Is there a way the who_am_i method can be placed in the parent class, but return the package name of the actual initiated class (the child) ?
Sorry for such a basic question!