On Tue, Aug 27, 2002 at 10:28:25AM -0700, drieux wrote: > Volks, > > am I just slow or what?
I wouldn't go that far ;-) > but when I went to make the method in B1 that C would > inherit to display the inheritence chain, I had thought > I could likewise get away with the 'SUPER' trick a la > > sub parent_chain { > my ($me) = @_; > > my @generations = ref($me); > > for my $parent ( @{$me->child_of()} ) { > # > # check that my 'SUPER' can parent_chain() > # I think this is your problem. You're not checking what you said you were checking. You are calling the can() method of the superclass on the object $me and the method parent_chain(). The can() of the superclass is (probably) the same as for $me, so you are asking if $me->parent_chain() exists, which it does since we are in it. > if ( my $sub_ref = $me->SUPER::can('parent_chain')) { > # this is line #83 So you will always take this branch of the conditional. > my $grand_parents = $me->SUPER::parent_chain(); > push(@generations, $_) for (@$grand_parents); > } else { > push(@generations, $parent); > } > } > > return(\@generations); > } > > only to get the error message on the order of > > File "B1.pm"; Line 84: > Can't locate object method "parent_chain" via package "B1" > > and then it HIT ME! > > Smack! - and this is where I need some help making sure > that my 'explanaition' matches the 'real answer'... I think not, but your solution seems to be correct anyway. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]