rkg has asked for the wisdom of the Perl Monks concerning the following question:
For debugging assistance (eg I am having some trouble with ClassMethod::Maker's "object_list" method; I can't seem to find the promised resulting LOO method):
how can one determine all valid methods for an arbitrary object?
Thanks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: OO: All Methods
by Abigail-II (Bishop) on Dec 15, 2003 at 11:35 UTC | |
But you can get some impression of what's there by inspecting the ISA tree of the class, and walking the stashes of the class and its ISA inheritance tree, and see whether there are any code ref entries in the stashes. However, that doesn't distinguish between class private "normal" subroutines, and subroutines intended to be called as class or object methods. Perhaps your best option is to read the documentation of the object. Abigail | [reply] [Watch: Dir/Any] |
by rkg (Hermit) on Dec 15, 2003 at 11:48 UTC | |
Well, the documentation is shockingly deficient; I intend immediately to send a nasty email to the author. Errr... that'd be me. <g>
Seriously, my issue is with C:MM (actually, my subclass of it): So thanks for advice. Any pointers around the monastery to a code snippet that does the walk you describe? Thanks, Abigail-II -- | [reply] [Watch: Dir/Any] [d/l] [select] |
by Abigail-II (Bishop) on Dec 15, 2003 at 12:04 UTC | |
Calling this with IO::File as argument gives:
| [reply] [Watch: Dir/Any] [d/l] [select] |
by simonm (Vicar) on Dec 15, 2003 at 17:54 UTC | |
You might want to double-check that the expected methods are being installed as you expect. You could add a logging install_methods in your subclass:
| [reply] [Watch: Dir/Any] [d/l] |
Re: OO: All Methods
by zentara (Archbishop) on Dec 15, 2003 at 16:59 UTC | |
OUTPUT:
| [reply] [Watch: Dir/Any] [d/l] [select] |
Re: OO: All Methods
by Anonymous Monk on Dec 16, 2003 at 06:31 UTC | |
OK, so that doesn't solve the AUTOLOAD situation, but it does deal with some of the weirder bits, like ignoring anonymous and overload stuff correctly. | [reply] [Watch: Dir/Any] |