alafarm has asked for the wisdom of the Perl Monks concerning the following question:
I'm troubleshooting some old code and I'm getting mixed up about method inheritance. My example is summarized below, which represent two packages in different .pm files.
Package two inherits from package one. But when the "run" method is called, which in turn calls "_dosomething", the AUTOLOAD sub runs instead of "_dosomething". Does the call to "_dosomething" need to be prefixed by an explicit package name or self object?
(Of course the problem could be something else, but I want to make sure my understanding of inheritance is correct.)
package one; sub _dosomething {...}; sub AUTOLOAD {...}; package two; use one; @ISA = qw(one); sub run { _dosomething ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Method inheritance
by moritz (Cardinal) on May 11, 2012 at 17:21 UTC | |
by alafarm (Novice) on May 11, 2012 at 17:33 UTC | |
|
Re: Method inheritance
by jdporter (Paladin) on May 11, 2012 at 17:28 UTC |