From: Jesse Luehrs Date: Mon, 13 Feb 2012 08:00:34 +0000 (-0600) Subject: s/op/operator/g X-Git-Tag: 2.0500~25 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=644d6eaacc4b24118f85c91026d4d7ea760c8988;p=gitmo%2FMoose.git s/op/operator/g --- diff --git a/lib/Class/MOP/Method/Overload.pm b/lib/Class/MOP/Method/Overload.pm index 68ccc3a..91a3311 100644 --- a/lib/Class/MOP/Method/Overload.pm +++ b/lib/Class/MOP/Method/Overload.pm @@ -14,11 +14,11 @@ sub wrap { unshift @args, 'body' if @args % 2 == 1; my %params = @args; - confess "op is required" - unless exists $params{op}; + confess "operator is required" + unless exists $params{operator}; return $class->SUPER::wrap( - name => "($params{op}", + name => "($params{operator}", %params, ); } @@ -39,7 +39,7 @@ sub _new { 'original_method' => $params->{original_method}, # defined in this class - 'op' => $params->{op}, + 'operator' => $params->{operator}, } => $class; } diff --git a/lib/Class/MOP/Mixin/HasMethods.pm b/lib/Class/MOP/Mixin/HasMethods.pm index e0ecb3a..dd04fc0 100644 --- a/lib/Class/MOP/Mixin/HasMethods.pm +++ b/lib/Class/MOP/Mixin/HasMethods.pm @@ -205,9 +205,9 @@ sub _full_method_map { # overloading -my $overload_ops; -sub overload_ops { - $overload_ops ||= [map { split /\s+/ } values %overload::ops]; +my $overload_operators; +sub overload_operators { + $overload_operators ||= [map { split /\s+/ } values %overload::ops]; } # XXX this could probably stand to be cached, but i figure it should be @@ -218,7 +218,7 @@ sub _overload_map { return {} unless overload::Overloaded($self->name); my %map; - for my $op (@{ $self->overload_ops }) { + for my $op (@{ $self->overload_operators }) { my $body = overload::Method($self->name, $op); next unless defined $body; $map{$op} = $body; @@ -233,18 +233,18 @@ sub get_overload_list { return map { $self->_wrap_overload($_, $map->{$_}) } keys $map; } -sub get_overloaded_ops { +sub get_overloaded_operators { my $self = shift; return keys $self->_overload_map; } -sub has_overloaded_op { +sub has_overloaded_operator { my $self = shift; my ($op) = @_; return defined overload::Method($op); } -sub get_overloaded_op { +sub get_overloaded_operator { my $self = shift; my ($op) = @_; my $body = overload::Method($op); @@ -262,7 +262,7 @@ sub _wrap_overload { my $self = shift; my ($op, $body) = @_; return Class::MOP::Method::Overload->wrap( - op => $op, + operator => $op, package_name => $self->name, associated_metaclass => $self, body => $body, diff --git a/mop.c b/mop.c index 6f58b48..6cb77f0 100644 --- a/mop.c +++ b/mop.c @@ -221,7 +221,7 @@ static struct { DECLARE_KEY(writer), DECLARE_KEY_WITH_VALUE(package_cache_flag, "_package_cache_flag"), DECLARE_KEY_WITH_VALUE(_version, "-version"), - DECLARE_KEY(op) + DECLARE_KEY(operator) }; SV * diff --git a/mop.h b/mop.h index 92ba852..830716f 100644 --- a/mop.h +++ b/mop.h @@ -64,7 +64,7 @@ typedef enum { KEY_writer, KEY_package_cache_flag, KEY__version, - KEY_op, + KEY_operator, key_last, } mop_prehashed_key_t; diff --git a/t/metaclasses/overloading.t b/t/metaclasses/overloading.t index c6c3659..8c5bdd1 100644 --- a/t/metaclasses/overloading.t +++ b/t/metaclasses/overloading.t @@ -10,7 +10,7 @@ use Test::More; { is_deeply([Foo->meta->get_overload_list], []); - is_deeply([Foo->meta->get_overloaded_ops], []); + is_deeply([Foo->meta->get_overloaded_operators], []); } my $plus; @@ -23,12 +23,12 @@ BEGIN { $plus_impl = sub { $plus = 1; $_[0] + $_[1] } } } { - is_deeply([Foo::Overloaded->meta->get_overloaded_ops], ['+']); + is_deeply([Foo::Overloaded->meta->get_overloaded_operators], ['+']); my @overloads = Foo::Overloaded->meta->get_overload_list; is(scalar(@overloads), 1); my $plus_meth = $overloads[0]; isa_ok($plus_meth, 'Class::MOP::Method::Overload'); - is($plus_meth->op, '+'); + is($plus_meth->operator, '+'); is($plus_meth->name, '(+'); is($plus_meth->body, $plus_impl); is($plus_meth->package_name, 'Foo::Overloaded'); diff --git a/xs/Overload.xs b/xs/Overload.xs index eac5ae5..4fdf971 100644 --- a/xs/Overload.xs +++ b/xs/Overload.xs @@ -5,4 +5,4 @@ MODULE = Class::MOP::Method::Overload PACKAGE = Class::MOP::Method::Overload PROTOTYPES: DISABLE BOOT: - INSTALL_SIMPLE_READER(Method::Overload, op); + INSTALL_SIMPLE_READER(Method::Overload, operator);