Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: how to find the module of a specific function?by kcott (Archbishop) |
on Oct 26, 2017 at 19:55 UTC ( [id://1202090]=note: print w/replies, xml ) | Need Help?? |
G'day rumpumpel1, "how can I systematically find the module, in which the login function appears?" In whatever OO hierarchy you have, it's entirely possible that any method could be present in more than one class. I'm going to assume you mean the class where the method is found first according to whatever method resolution order you're using. See "mro - Method Resolution Order" for more about that; and for any questions you might have regarding how I've used that pragma in the following code.
Output:
Update: After posting I thought the "Objects blessed into class: A" looked a bit odd; then realised I'd screwed up the constructor: "sub new { bless {} => __PACKAGE__ }". I've fixed that (now: sub new { bless {} => $_[0] }); after rerunning, the output now has "Objects blessed into class: A::B::C" (which looks somewhat saner). None of the other code or output has changed. — Ken
In Section
Seekers of Perl Wisdom
|
|