Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Failing inheritance or what can make a Child disinherited ?

by shemp (Deacon)
on Aug 02, 2004 at 20:24 UTC ( #379416=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Failing inheritance or what can make a Child disinherited ?
in thread Failing inheritance or what can make a Child disinherited ?

Not too long ago i created this piece of code to try to help with some debugging. It should tell you the entire ancestor tree of your object. I dont think the order is exactly like the way that methods would be searched for, but i thought of this code when i first read your post.

Put this method in your Child class. (hopefully you'll be able to call it.)

sub isa_descent { my $self = shift @_; my ($class) = @_; print "\npackage: $class\n"; no strict 'refs'; my @ancestors = @{ 'main::' . $class . '::ISA' }; use strict; foreach my $ancestor ( @ancestors ) { print "...ancestor: $ancestor\n"; $self->isa_descent($ancestor); } }
You'll want to call it from outside the class probably, perhaps just after creating the object instance. The output wont change unless you're messing with @ISA.
$o->isa_descent(ref $o);


Comment on Re^3: Failing inheritance or what can make a Child disinherited ?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://379416]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (11)
As of 2015-07-28 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls