Using this in various places can make our code much more efficient, since we
avoid calling get_method twice.
for my $class ( reverse $self->linearized_isa ) {
my $meta = Class::MOP::Class->initialize($class);
- $methods{$_} = $meta->get_method($_)
- for $meta->get_method_list;
+ $methods{ $_->name } = $_ for $meta->_get_local_methods;
}
return values %methods;
keys %{$namespace};
}
+# This should probably be what get_method_list actually does, instead of just
+# returning names. This was created as a much faster alternative to
+# $meta->get_method($_) for $meta->get_method_list
+sub _get_local_methods {
+ my $self = shift;
+
+ my $namespace = $self->namespace;
+
+ return map { $self->get_method($_) } grep { *{ $namespace->{$_} }{CODE} }
+ keys %{$namespace};
+}
+
1;
__END__