working role support!
[gitmo/MooseX-StrictConstructor.git] / lib / MooseX / StrictConstructor.pm
index e7cfda2..a16b392 100644 (file)
@@ -10,6 +10,7 @@ use MooseX::StrictConstructor::Role::Object;
 
 {
     my %class_meta;
+    my %role_meta;
 
     if ( $Moose::VERSION < 1.9900 ) {
         require MooseX::StrictConstructor::Trait::Method::Constructor;
@@ -22,10 +23,17 @@ use MooseX::StrictConstructor::Role::Object;
         require MooseX::StrictConstructor::Trait::Class;
         %class_meta
             = ( class => ['MooseX::StrictConstructor::Trait::Class'] );
+        %role_meta
+            = (
+                role => ['MooseX::StrictConstructor::Trait::Role'],
+                application_to_class => ['MooseX::StrictConstructor::Trait::ApplicationToClass'],
+                application_to_role =>['MooseX::StrictConstructor::Trait::ApplicationToRole'],
+              );
     }
 
     Moose::Exporter->setup_import_methods(
             class_metaroles  => \%class_meta,
+            role_metaroles   => \%role_meta,
             base_class_roles => ['MooseX::StrictConstructor::Role::Object'],
     );
 }
@@ -59,6 +67,10 @@ constructor is called with an attribute init argument that your class
 does not declare, then it calls C<Moose->throw_error()>. This is a great way
 to catch small typos.
 
+As of Moose 1.9900, this module can also be used in a role, in which case the
+constructor of the consuming class will become strict.
+
+
 =head2 Subverting Strictness
 
 You may find yourself wanting to have your constructor accept a