first pass at allowing Moose and Moose::Role to omit the meta method
[gitmo/Moose.git] / lib / Moose.pm
index 537a923..56a70c7 100644 (file)
@@ -198,9 +198,16 @@ sub init_meta {
         $meta = $metaclass->initialize($class);
     }
 
-    unless ( $meta->has_method("meta") ) { # don't overwrite
+    unless ($args{no_meta}) {
         # also check for inherited non moose 'meta' method?
-        # FIXME also skip this if the user requested by passing an option
+        my $existing = $meta->get_method('meta');
+        if ($existing && !$existing->isa('Class::MOP::Method::Meta')) {
+            warn "Moose is overwriting an existing method named 'meta' "
+               . "with its own version, in class $class. If this is actually "
+               . "what you want, you should remove the existing method, "
+               . "otherwise, you should pass the '-no_meta => 1' option to "
+               . "'use Moose'.";
+        }
         $meta->_add_meta_method;
     }