I'm dealing with an apparent simple issue.
I'm writing a module similar to UML::Class::Simple but with some improvements. Summarizing, the idea is to retrieve a record card for each module in a given source, containing information about the Methods, Properties, Dependencies and Children. My current problem is getting Methods and Properties for each module. Let's see the code I've already written:
use Class::Inspector;
use Data::Dumper;
sub _load_methods{
my $pkg = shift;
my $methods = Class::Inspector->methods( $pkg, 'expanded' );
print Dumper $methods;
return 1;
}
Calling this function for a given package, I get more methods than I expect. The reason is Class::Inspector returns all inherited methods and also the accessors if the module is a Moose::Object. I would like to filter all of this methods to get just those defined in the given package, not in its parents.
Can anyone provide an elegant way to filter the list of methods in the way I suggest?
Thanks in advance.