Implement "with" but no role application quite yet
[gitmo/Mouse.git] / lib / Mouse.pm
index ae3a0b7..cb525f0 100644 (file)
@@ -68,6 +68,18 @@ do {
         around => sub {
             return \&Class::Method::Modifiers::around;
         },
+
+        with => sub {
+            my $caller = $CALLER;
+
+            return sub {
+                my $role  = shift;
+                my $class = $caller->meta;
+
+                Mouse::load_class($role);
+                $role->apply_to_class($class);
+            };
+        },
     );
 
     my $exporter = Sub::Exporter::build_exporter({