Bump version to 1.9900 for new version numbering scheme
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Array / accessor.pm
1 package Moose::Meta::Method::Accessor::Native::Array::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::Array::set' => {
13     -excludes => [
14         qw( _generate_method
15             _minimum_arguments
16             _maximum_arguments
17             _inline_process_arguments
18             _inline_check_arguments
19             _return_value)
20     ]
21     },
22     'Moose::Meta::Method::Accessor::Native::Array::get' => {
23     -excludes => [
24         qw(
25             _generate_method
26             _minimum_arguments
27             _maximum_arguments
28             )
29     ]
30     };
31
32 sub _generate_method {
33     my $self = shift;
34
35     my $inv         = '$self';
36     my $slot_access = $self->_get_value($inv);
37
38     return (
39         'sub {',
40             'my ' . $inv . ' = shift;',
41             $self->_inline_curried_arguments,
42             $self->_inline_check_lazy($inv, '$type_constraint', '$type_constraint_obj'),
43             # get
44             'if (@_ == 1) {',
45                 $self->_inline_check_var_is_valid_index('$_[0]'),
46                 $self->Moose::Meta::Method::Accessor::Native::Array::get::_inline_return_value($slot_access),
47             '}',
48             # set
49             'else {',
50                 $self->_inline_writer_core($inv, $slot_access),
51             '}',
52         '}',
53     );
54 }
55
56 sub _minimum_arguments { 1 }
57 sub _maximum_arguments { 2 }
58
59 no Moose::Role;
60
61 1;