Use the is_anon_class method we already have
Shawn M Moore [Sat, 19 Feb 2011 04:07:14 +0000 (23:07 -0500)]
lib/Class/MOP/Class.pm

index ec803e4..43628f2 100644 (file)
@@ -449,7 +449,7 @@ sub _remove_generated_metaobjects {
         return if in_global_destruction(); # it'll happen soon anyway and this just makes things more complicated
 
         $self->free_anon_class
-            unless $name =~ /^$ANON_CLASS_PREFIX/o;
+            if $self->is_anon_class;
     }
 
     sub free_anon_class {