From: Shawn M Moore Date: Thu, 19 Jun 2008 00:12:15 +0000 (+0000) Subject: Make it so Mouse doesn't overwrite attributes X-Git-Tag: 0.19~282 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0ba3591eefbedc68c2c3146926836f6f2fe0cf99;p=gitmo%2FMouse.git Make it so Mouse doesn't overwrite attributes --- diff --git a/lib/Mouse/Meta/Role.pm b/lib/Mouse/Meta/Role.pm index 870b69d..9b4aec5 100644 --- a/lib/Mouse/Meta/Role.pm +++ b/lib/Mouse/Meta/Role.pm @@ -51,6 +51,7 @@ sub apply { my $pkg = $class->name; for my $name ($self->get_attribute_list) { + next if $class->has_attribute($name); my $spec = $self->get_attribute($name); Mouse::Meta::Attribute->create($pkg, $name, %$spec); } diff --git a/t/402-basic-role-application.t b/t/402-basic-role-application.t index 1191d03..d05f818 100644 --- a/t/402-basic-role-application.t +++ b/t/402-basic-role-application.t @@ -46,8 +46,5 @@ lives_ok { with 'Role2'; }; -TODO: { - local $TODO = "Moose prefers first definition, Mouse the last"; - is(Class2->meta->get_attribute('attr')->default, 'Role'); -}; +is(Class2->meta->get_attribute('attr')->default, 'Role');