with()ing ordinary roles
[gitmo/MooseX-Role-Parameterized.git] / lib / MooseX / Role / Parameterized.pm
index 24152fe..0ef576e 100644 (file)
@@ -15,7 +15,7 @@ our $CURRENT_METACLASS;
 
 __PACKAGE__->setup_import_methods(
     with_caller => ['parameter', 'role', 'method'],
-    as_is       => ['has', 'extends', 'augment', 'inner'],
+    as_is       => ['has', 'with', 'extends', 'augment', 'inner'],
 );
 
 sub parameter {
@@ -84,6 +84,12 @@ sub method {
     $CURRENT_METACLASS->add_method($name => $method);
 }
 
+sub with {
+    confess "with must be called within the role { ... } block."
+        unless $CURRENT_METACLASS;
+    Moose::Util::apply_all_roles($CURRENT_METACLASS, @_);
+}
+
 sub extends { croak "Roles do not currently support 'extends'" }
 
 sub inner { croak "Roles cannot support 'inner'" }