sub get_method_list {
my $self = shift;
- my $namespace = $self->namespace;
-
- # Constants may show up as some sort of non-GLOB reference in the
- # namespace hash ref, depending on the Perl version.
- return grep {
- defined $namespace->{$_}
- && ( ref( \$namespace->{$_} ) ne 'GLOB'
- || *{ $namespace->{$_} }{CODE} )
- && $self->has_method($_)
- }
- keys %{$namespace};
+ return keys %{ $self->_full_method_map };
}
# This should probably be what get_method_list actually does, instead of just
sub _get_local_methods {
my $self = shift;
- my $namespace = $self->namespace;
-
- return map { $self->get_method($_) }
- grep {
- defined $namespace->{$_}
- && ( ref $namespace->{$_}
- || *{ $namespace->{$_} }{CODE} )
- }
- keys %{$namespace};
+ return values %{ $self->_full_method_map };
}
sub _restore_metamethods_from {
$self->{'_package_cache_flag'} = Class::MOP::check_package_cache_flag($self->name);
}
+sub _full_method_map {
+ my $self = shift;
+
+ my $pkg_gen = Class::MOP::check_package_cache_flag($self->name);
+
+ if (($self->{_package_cache_flag_full} || -1) != $pkg_gen) {
+ # forcibly reify all method map entries
+ $self->get_method($_)
+ for $self->list_all_package_symbols('CODE');
+ $self->{_package_cache_flag_full} = $pkg_gen;
+ }
+
+ return $self->_method_map;
+}
+
1;
__END__