From: Jesse Luehrs Date: Thu, 27 Jan 2011 15:18:51 +0000 (-0600) Subject: need to delete from the method map, not just set to undef (kentnl) X-Git-Tag: 1.9903~28 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=16d1744a09cb08cb096e84d72831ba6f1cb312b6;p=gitmo%2FMoose.git need to delete from the method map, not just set to undef (kentnl) --- diff --git a/t/001_cmop/003_methods.t b/t/001_cmop/003_methods.t index a94ae99..1f60918 100644 --- a/t/001_cmop/003_methods.t +++ b/t/001_cmop/003_methods.t @@ -394,5 +394,14 @@ is_deeply( ok(!DeleteFromMe->can('foo')); } +{ + my $baz_meta = Class::MOP::Class->initialize('Baz'); + $baz_meta->add_method(foo => sub { }); + my $stash = Package::Stash->new('Baz'); + $stash->remove_package_symbol('&foo'); + is_deeply([$baz_meta->get_method_list], [], "method is deleted"); + ok(!Baz->can('foo'), "Baz can't foo"); +} + done_testing; diff --git a/xs/HasMethods.xs b/xs/HasMethods.xs index 78f15dc..047e1b2 100644 --- a/xs/HasMethods.xs +++ b/xs/HasMethods.xs @@ -37,8 +37,8 @@ mop_update_method_map(pTHX_ HV *const stash, HV *const map) continue; } - /* $map->{$method_name} = undef */ - sv_setsv(method, &PL_sv_undef); + /* delete $map->{$method_name} */ + hv_delete(map, method_name, method_name_len, G_DISCARD); } }