Bump version to 1.9900 for new version numbering scheme
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Hash / accessor.pm
1 package Moose::Meta::Method::Accessor::Native::Hash::accessor;
2
3 use strict;
4 use warnings;
5
6 our $VERSION = '1.9900';
7 $VERSION = eval $VERSION;
8 our $AUTHORITY = 'cpan:STEVAN';
9
10 use Moose::Role;
11
12 with 'Moose::Meta::Method::Accessor::Native::Hash::set' => {
13     -excludes => [
14         qw(
15             _generate_method
16             _minimum_arguments
17             _maximum_arguments
18             _inline_check_arguments
19             _return_value
20             )
21     ]
22     },
23     'Moose::Meta::Method::Accessor::Native::Hash::get' => {
24     -excludes => [
25         qw(
26             _generate_method
27             _minimum_arguments
28             _maximum_arguments
29             _inline_check_argument_count
30             _inline_process_arguments
31             )
32     ]
33     };
34
35 sub _generate_method {
36     my $self = shift;
37
38     my $inv         = '$self';
39     my $slot_access = $self->_get_value($inv);
40
41     return (
42         'sub {',
43             'my ' . $inv . ' = shift;',
44             $self->_inline_curried_arguments,
45             $self->_inline_check_lazy($inv, '$type_constraint', '$type_constraint_obj'),
46             # get
47             'if (@_ == 1) {',
48                 $self->_inline_check_var_is_valid_key('$_[0]'),
49                 $self->Moose::Meta::Method::Accessor::Native::Hash::get::_inline_return_value($slot_access),
50             '}',
51             # set
52             'else {',
53                 $self->_inline_writer_core($inv, $slot_access),
54             '}',
55         '}',
56     );
57 }
58
59 sub _minimum_arguments { 1 }
60 sub _maximum_arguments { 2 }
61
62 no Moose::Role;
63
64 1;