Created
June 28, 2016 18:35
-
-
Save tokubass/a66c87c7a896a4418fb33a609cd6e3fb to your computer and use it in GitHub Desktop.
Class::Inspector結果をハッシュにまとめる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my %seen_pkg; | |
my %result; | |
for my $method_struct (@{Class::Inspector->methods(ref $self, 'expanded')}) { | |
my $pkg_name = $method_struct->[1]; | |
my $method_name = $method_struct->[2]; | |
if (exists $seen_pkg{$pkg_name}) { | |
$result{$pkg_name} //= []; | |
push @{$result{$pkg_name}}, $method_name; | |
} | |
$seen_pkg{$pkg_name}++; | |
} | |
local $Data::Dumper::Indent = 1; | |
local $Data::Dumper::Terse = 1; | |
warn Dumper \%result; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment