#!/usr/bin/perl use strict; use warnings; no strict 'refs'; ## ------------------------------------------------------------------ # if you want certain methods ignored, # put their names in this string and it # will get weeded out with a reg-ex. my $IGNORE = ""; sub getClassMethodList { my $class = shift; return grep { !/^($IGNORE)$/ && defined &{"${class}::$_"} } keys %{"${class}::"}; } sub getCompleteClassMethodList { my ($class) = @_; my @methods = getClassMethodList($class); push @methods => map { getCompleteClassMethodList($_) } @{"${class}::ISA"}; return @methods; } ## ------------------------------------------------------------------ sub printExpandedClassView { my ($class, $tab_count) = @_; $tab_count ||= 0; if ($tab_count) { my $t = ("\t" x $tab_count); print "${t}$class\n"; print "${t}-------------------------------------------\n$t"; print join "\n${t}", getClassMethodList($class); print "\n"; } else { print("$class\n"); print "-------------------------------------------\n"; print join "\n" => getClassMethodList($class); print "\n"; } map { printExpandedClassView($_, $tab_count + 1) } @{"${class}::ISA"}; } sub printFlatClassView { my ($class) = @_; print("$class\n"); print "-------------------------------------------\n"; my %method = map { $_ => 1 } getCompleteClassMethodList($class); print join "\n" => keys %method; print "\n"; } ## ------------------------------------------------------------------ use IO::File; printFlatClassView("IO::File"); print "\n"; printExpandedClassView("IO::File"); print "\n"; 1;