Merge branch 'master' into attribute_helpers
[gitmo/Moose.git] / lib / Moose / Meta / Class.pm
index 9059a02..7cf3ca5 100644 (file)
@@ -11,7 +11,7 @@ use List::Util qw( first );
 use List::MoreUtils qw( any all uniq first_index );
 use Scalar::Util 'weaken', 'blessed';
 
-our $VERSION   = '0.84';
+our $VERSION   = '0.88';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -243,11 +243,17 @@ sub superclasses {
 
 sub add_attribute {
     my $self = shift;
-    $self->SUPER::add_attribute(
+    my $attr =
         (blessed $_[0] && $_[0]->isa('Class::MOP::Attribute')
             ? $_[0]
-            : $self->_process_attribute(@_))
-    );
+            : $self->_process_attribute(@_));
+    $self->SUPER::add_attribute($attr);
+    # it may be a Class::MOP::Attribute, theoretically, which doesn't have
+    # 'bare' and doesn't implement this method
+    if ($attr->can('_check_associated_methods')) {
+        $attr->_check_associated_methods;
+    }
+    return $attr;
 }
 
 sub add_override_method_modifier {