Fix error message
[gitmo/MooseX-ClassAttribute.git] / lib / MooseX / ClassAttribute / Trait / Role / Composite.pm
index deaef10..5d4d000 100644 (file)
@@ -35,7 +35,7 @@ sub _merge_class_attributes {
             Moose->throw_error( "Role '"
                     . $self->name()
                     . "' has encountered a class attribute conflict "
-                    . "during composition. This is fatal error and cannot be disambiguated."
+                    . "during composition. This is a fatal error and cannot be disambiguated."
             );
         }
 
@@ -53,8 +53,10 @@ around apply_params => sub {
     my $orig = shift;
     my $self = shift;
 
-    my $metarole = Moose::Util::MetaRole::apply_metaroles(
-        for            => $self->$orig(@_),
+    $self->$orig(@_);
+
+    $self = Moose::Util::MetaRole::apply_metaroles(
+        for            => $self,
         role_metaroles => {
             application_to_class =>
                 ['MooseX::ClassAttribute::Trait::Application::ToClass'],
@@ -63,9 +65,9 @@ around apply_params => sub {
         },
     );
 
-    $metarole->_merge_class_attributes();
+    $self->_merge_class_attributes();
 
-    return $metarole;
+    return $self;
 };
 
 1;