継承を追う。
ピークは越えたが、まだやる事沢山。あうー。
って訳で今日も軽く勉強。
継承関係がごちゃごちゃしてるクラスを扱ってるので
なんか便利なライブラリないんかなぁ…と思ったら、
#!/usr/bin/perl -wuse strict;
use Devel::Symdump;
use Parent::Child::Grandchild::Greatgrandchild;
my $objParent= Parent->new();
my $obj = Devel::Symdump->rnew($objParent);
print $obj->isa_tree();
print $obj->inh_tree();
exit;
この継承は簡単で、Parent を Child が継承し、
Child を Grandchild が継承、
Grandchild を Greatgrandchild が継承って関係を表示すっと。
・isa_tree の結果
CarpExporter
Parent::Child::Grandchild::Greatgrandchild
Parent::Child::Grandchild
Parent::Child
Parent
Parent::Child::Grandchild
Parent::Child
Parent
Parent::Child
Parent
・inh_tree の結果
ExporterCarp
Parent
Parent::Child
Parent::Child::Grandchild
Parent::Child::Grandchild::Greatgrandchild
Parent::Child
Parent::Child::Grandchild
Parent::Child::Grandchild::Greatgrandchild
Parent::Child::Grandchild
Parent::Child::Grandchild::Greatgrandchild
残念ながら、途中から混乱してそーなパターンとか多重継承とか
「もう人間の目で追うのは出来ません」くらいの深さは勝手に追ってくれなくて?
use XXX した物からしか、調べに行ってくれないっぽい orz