X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse.pm;h=1f1e3866398e7e809b90c41fd2dd6b305120ee10;hb=a02698f11a62bdf881c1a00651c2426b95095b29;hp=2e71b9f73a6bee304c38c7c48f5c002c28a0c3ad;hpb=66efb1c8a37ac10378a07dd550e583efe0c7d62d;p=gitmo%2FMouse.git diff --git a/lib/Mouse.pm b/lib/Mouse.pm index 2e71b9f..1f1e386 100644 --- a/lib/Mouse.pm +++ b/lib/Mouse.pm @@ -3,7 +3,7 @@ package Mouse; use strict; use warnings; -our $VERSION = '0.04'; +our $VERSION = '0.05'; use 5.006; use Sub::Exporter; @@ -39,7 +39,12 @@ do { $names = [$names] if !ref($names); for my $name (@$names) { - Mouse::Meta::Attribute->create($package, $name, @_); + if ($name =~ s/^\+//) { + Mouse::Meta::Attribute->clone_parent($package, $name, @_); + } + else { + Mouse::Meta::Attribute->create($package, $name, @_); + } } }; }, @@ -63,6 +68,20 @@ do { around => sub { return \&Class::Method::Modifiers::around; }, + + with => sub { + my $caller = $CALLER; + + return sub { + my $role = shift; + my $class = $caller->meta; + + confess "Mouse::Role only supports 'with' on individual roles at a time" if @_; + + Mouse::load_class($role); + $role->meta->apply($class); + }; + }, ); my $exporter = Sub::Exporter::build_exporter({