need to delete from the method map, not just set to undef (kentnl)
Jesse Luehrs [Thu, 27 Jan 2011 15:18:51 +0000 (09:18 -0600)]
t/001_cmop/003_methods.t
xs/HasMethods.xs

index a94ae99..1f60918 100644 (file)
@@ -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;
index 78f15dc..047e1b2 100644 (file)
@@ -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);
     }
 }