From: Jesse Luehrs Date: Sat, 10 Mar 2012 23:14:17 +0000 (-0600) Subject: rename these for more consistency X-Git-Tag: 2.0500~20 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=87a1f36e0f0e38af826028d2dbd8b3d85ccca101;p=gitmo%2FMoose.git rename these for more consistency --- diff --git a/lib/Class/MOP/Mixin/HasMethods.pm b/lib/Class/MOP/Mixin/HasMethods.pm index aedd190..5f6a4db 100644 --- a/lib/Class/MOP/Mixin/HasMethods.pm +++ b/lib/Class/MOP/Mixin/HasMethods.pm @@ -235,13 +235,13 @@ sub _overload_map { sub get_overload_list { my $self = shift; - my $map = $self->_overload_map; - return map { $self->_wrap_overload($_, $map->{$_}) } keys $map; + return keys $self->_overload_map; } -sub get_overloaded_operators { +sub get_all_overloaded_operators { my $self = shift; - return keys $self->_overload_map; + my $map = $self->_overload_map; + return map { $self->_wrap_overload($_, $map->{$_}) } keys $map; } sub has_overloaded_operator { diff --git a/t/metaclasses/overloading.t b/t/metaclasses/overloading.t index f2227c8..ebc2f12 100644 --- a/t/metaclasses/overloading.t +++ b/t/metaclasses/overloading.t @@ -20,10 +20,10 @@ use Test::Fatal; ok(!$meta->has_overloaded_operator('+')); ok(!$meta->has_overloaded_operator('-')); - is_deeply([$meta->get_overloaded_operators], []); - is_deeply([$meta->get_overload_list], []); + is_deeply([$meta->get_all_overloaded_operators], []); + is($meta->get_overloaded_operator('+'), undef); is($meta->get_overloaded_operator('-'), undef); } @@ -45,9 +45,9 @@ BEGIN { $plus_impl = sub { $plus = 1; "plus" } } ok($meta->has_overloaded_operator('+')); ok(!$meta->has_overloaded_operator('-')); - is_deeply([$meta->get_overloaded_operators], ['+']); + is_deeply([$meta->get_overload_list], ['+']); - my @overloads = $meta->get_overload_list; + my @overloads = $meta->get_all_overloaded_operators; is(scalar(@overloads), 1); my $plus_meth = $overloads[0]; isa_ok($plus_meth, 'Class::MOP::Method::Overload'); @@ -79,9 +79,9 @@ BEGIN { $plus_impl = sub { $plus = 1; "plus" } } ok($meta->has_overloaded_operator('-')); - is_deeply([sort $meta->get_overloaded_operators], ['+', '-']); + is_deeply([sort $meta->get_overload_list], ['+', '-']); - is(scalar($meta->get_overload_list), 2); + is(scalar($meta->get_all_overloaded_operators), 2); my $minus_meth = $meta->get_overloaded_operator('-'); isa_ok($minus_meth, 'Class::MOP::Method::Overload');