|Do you know where your variables are?|
Extending parent object method?by Syndaryl (Initiate)
|on Mar 09, 2012 at 19:31 UTC||Need Help??|
Syndaryl has asked for the
wisdom of the Perl Monks concerning the following question:
Answered! Many thanks again!
No Moose, just bare perl... More's the pity.
I have a child object inheriting a parent object - I can call methods that are on the parent object, not the child, access properties defined on the parent object, etc.
I can override a parent method, but in this case I don't want to do that - I want to call the parent object's method and then execute more child-specific code after that. I have the code to call the parent object's constructor from within my childs constructor, but the same code doesn't seem to work on other methods, which is both annoying and confusing me.What I have for my constructor:
Works a treat. However if I have something like
perl barfs up and reports "Can't use string (<object name>) as a HASH ref while "strict refs" in use at ..." on the $class->SUPER::reset(@_) line.
It's even truncating the object name, which is REALLY confusing me - instead of "...::DocumentManager::PlainText" for the string it's unhappy with, it's saying "...::DocumentManager::Pl". (full object path redacted for the sake of my employer).
In a fit of wild flailing I tried $class::SUPER::reset($self, @_); but that just gives a syntax error.
So I'm clearly Not Doing This Right.