Implement "with" but no role application quite yet
Shawn M Moore [Tue, 17 Jun 2008 03:43:59 +0000 (03:43 +0000)]
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({