fix for compat with Moose 1.25
[gitmo/MooseX-StrictConstructor.git] / lib / MooseX / StrictConstructor / Trait / Class.pm
index 0c73318..579b6c2 100644 (file)
@@ -27,6 +27,19 @@ around '_inline_BUILDALL' => sub {
             'Moose->throw_error("Found unknown attribute(s) passed to the constructor: @bad");',
         '}',
     );
+} if $Moose::VERSION >= 1.9900;
+
+# If the base class role is applied first, and then a superclass is added, we
+# lose the role.
+after superclasses => sub {
+    my $self = shift;
+
+    return unless @_;
+
+    Moose::Util::MetaRole::apply_base_class_roles(
+        for   => $self->name(),
+        roles => ['MooseX::StrictConstructor::Role::Object'],
+    );
 };
 
 1;