From: Shawn M Moore Date: Tue, 10 Jun 2008 03:31:01 +0000 (+0000) Subject: Moose compat: handles are not canonicalized in the meta attribute's storage, instead... X-Git-Tag: 0.04~58 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c3cc36426995c03e0b44d087c6d0cf3f2a3ceb69;p=gitmo%2FMouse.git Moose compat: handles are not canonicalized in the meta attribute's storage, instead at handle generation time --- diff --git a/lib/Mouse/Attribute.pm b/lib/Mouse/Attribute.pm index c086b40..115af44 100644 --- a/lib/Mouse/Attribute.pm +++ b/lib/Mouse/Attribute.pm @@ -120,11 +120,12 @@ sub generate_clearer { sub generate_handles { my $attribute = shift; my $reader = $attribute->name; + my %handles = $attribute->_canonicalize_handles($attribute->handles); my %method_map; - for my $local_method (keys %{ $attribute->handles }) { - my $remote_method = $attribute->handles->{$local_method}; + for my $local_method (keys %handles) { + my $remote_method = $handles{$local_method}; my $method = 'sub { my $self = shift; @@ -147,9 +148,6 @@ sub create { if ref($args{default}) && ref($args{default}) ne 'CODE'; - $args{handles} = { $self->_canonicalize_handles($args{handles}) } - if $args{handles}; - $args{type_constraint} = delete $args{isa} if exists $args{isa}; diff --git a/t/019-handles.t b/t/019-handles.t index 79d29c2..e48511a 100644 --- a/t/019-handles.t +++ b/t/019-handles.t @@ -92,7 +92,7 @@ is($object->me->age, 21, "me->age"); is_deeply( $object->meta->get_attribute('me')->handles, - { name => 'name', age => 'age' }, + [ 'name', 'age' ], "correct handles layout for 'me'", );