From: Shawn M Moore Date: Wed, 18 Jun 2008 23:10:49 +0000 (+0000) Subject: Have Role->get_attribute return a reference instead of a list X-Git-Tag: 0.19~285 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ba33632ecfa5155f2bbb3b1b77e4d03c6895adb4;p=gitmo%2FMouse.git Have Role->get_attribute return a reference instead of a list --- diff --git a/lib/Mouse/Meta/Role.pm b/lib/Mouse/Meta/Role.pm index 78e01a4..734bebe 100644 --- a/lib/Mouse/Meta/Role.pm +++ b/lib/Mouse/Meta/Role.pm @@ -42,7 +42,7 @@ sub add_attribute { sub has_attribute { exists $_[0]->{attributes}->{$_[1]} } sub get_attribute_list { keys %{ $_[0]->{attributes} } } -sub get_attribute { @{ $_->[0]->{attributes}->{$_[1]} || [] } } +sub get_attribute { $_->[0]->{attributes}->{$_[1]} } sub apply { my $self = shift; @@ -50,8 +50,8 @@ sub apply { my $pkg = $class->name; for my $name ($self->get_attribute_list) { - my @spec = $self->get_attribute($name); - Mouse::Meta::Attribute->create($pkg, $name, @spec); + my $spec = $self->get_attribute($name); + Mouse::Meta::Attribute->create($pkg, $name, @$spec); } }