From: gfx Date: Mon, 6 Sep 2010 04:56:35 +0000 (+0900) Subject: Fix a bug that get_method_list() thrown the error for subroutine stubs X-Git-Tag: 1.08~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=130b7affbc975c1d24b7828c699caa5ccc902959;p=gitmo%2FClass-MOP.git Fix a bug that get_method_list() thrown the error for subroutine stubs --- diff --git a/lib/Class/MOP/Mixin/HasMethods.pm b/lib/Class/MOP/Mixin/HasMethods.pm index df91a13..ba48dd9 100644 --- a/lib/Class/MOP/Mixin/HasMethods.pm +++ b/lib/Class/MOP/Mixin/HasMethods.pm @@ -165,7 +165,7 @@ sub get_method_list { # ref, depending on the Perl version. return grep { defined $namespace->{$_} - && ( ref $namespace->{$_} || *{ $namespace->{$_} }{CODE} ) + && ( ref(\$namespace->{$_}) ne 'GLOB' || *{ $namespace->{$_} }{CODE} ) && $self->has_method($_) } keys %{$namespace}; diff --git a/t/003_methods.t b/t/003_methods.t index 418c9b8..5340b44 100644 --- a/t/003_methods.t +++ b/t/003_methods.t @@ -63,6 +63,9 @@ use Class::MOP::Method; my $Foo = Class::MOP::Class->initialize('Foo'); +is join(' ', sort $Foo->get_method_list), + 'FOO_CONSTANT baaz bang bar baz blah cake evaled_foo floob pie'; + ok( $Foo->has_method('pie'), '... got the method stub pie' ); ok( $Foo->has_method('cake'), '... got the constant method stub cake' );