stop using excludes within moose, since it's no longer necessary
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Hash / accessor.pm
CommitLineData
44babf1f 1package Moose::Meta::Method::Accessor::Native::Hash::accessor;
2
3use strict;
4use warnings;
5
8b9641b8 6use Moose::Role;
7
00bbc132 8with 'Moose::Meta::Method::Accessor::Native::Hash::set',
9 'Moose::Meta::Method::Accessor::Native::Hash::get';
10
11sub _inline_process_arguments {
12 my $self = shift;
13 $self->Moose::Meta::Method::Accessor::Native::Hash::set::_inline_process_arguments(@_);
14}
15
16sub _inline_check_argument_count {
17 my $self = shift;
18 $self->Moose::Meta::Method::Accessor::Native::Hash::set::_inline_check_argument_count(@_);
19}
20
21sub _inline_check_arguments {
22 my $self = shift;
23 $self->Moose::Meta::Method::Accessor::Native::Hash::set::_inline_check_arguments(@_);
24}
25
26sub _return_value {
27 my $self = shift;
28 $self->Moose::Meta::Method::Accessor::Native::Hash::set::_return_value(@_);
29}
44babf1f 30
31sub _generate_method {
32 my $self = shift;
33
53a4677c 34 my $inv = '$self';
1e2c801e 35 my $slot_access = $self->_get_value($inv);
44babf1f 36
53a4677c 37 return (
38 'sub {',
53a4677c 39 'my ' . $inv . ' = shift;',
40 $self->_inline_curried_arguments,
a619fc2f 41 $self->_inline_check_lazy($inv, '$type_constraint', '$type_coercion', '$type_message'),
53a4677c 42 # get
43 'if (@_ == 1) {',
44 $self->_inline_check_var_is_valid_key('$_[0]'),
178c5d84 45 $slot_access . '->{$_[0]}',
53a4677c 46 '}',
47 # set
48 'else {',
1e2c801e 49 $self->_inline_writer_core($inv, $slot_access),
53a4677c 50 '}',
51 '}',
52 );
44babf1f 53}
54
1e2c801e 55sub _minimum_arguments { 1 }
56sub _maximum_arguments { 2 }
44babf1f 57
8b9641b8 58no Moose::Role;
44babf1f 59
601;