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,
);
}
'original_method' => $params->{original_method},
# defined in this class
- 'op' => $params->{op},
+ 'operator' => $params->{operator},
} => $class;
}
# 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
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;
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);
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,
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 *
KEY_writer,
KEY_package_cache_flag,
KEY__version,
- KEY_op,
+ KEY_operator,
key_last,
} mop_prehashed_key_t;
{
is_deeply([Foo->meta->get_overload_list], []);
- is_deeply([Foo->meta->get_overloaded_ops], []);
+ is_deeply([Foo->meta->get_overloaded_operators], []);
}
my $plus;
}
{
- 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');
PROTOTYPES: DISABLE
BOOT:
- INSTALL_SIMPLE_READER(Method::Overload, op);
+ INSTALL_SIMPLE_READER(Method::Overload, operator);