From: Dave Rolsky Date: Sun, 14 Sep 2008 21:15:27 +0000 (+0000) Subject: Only skip destroying if the cached metaclas object is not the same as X-Git-Tag: 0.66~3^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=42c0f0e16769c77535cec6ef4c4e66c3a16fce65;p=gitmo%2FClass-MOP.git Only skip destroying if the cached metaclas object is not the same as the one going out of scope. --- diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index afa8212..cc57b6c 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -227,7 +227,8 @@ sub check_metaclass_compatability { # we don't want to clean out the namespace now. We can detect # that because Moose will explicitly update the singleton # cache in Class::MOP. - return if Class::MOP::does_metaclass_exist($self->name); + my $current_meta = Class::MOP::get_metaclass_by_name($self->name); + return if $current_meta ne $self; my ($serial_id) = ($self->name =~ /^$ANON_CLASS_PREFIX(\d+)/); no strict 'refs';