Commit | Line | Data |
f7fd22b6 |
1 | package Moose::Meta::Method::Accessor::Native::Array::Reader; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | our $VERSION = '1.13'; |
7 | $VERSION = eval $VERSION; |
8 | our $AUTHORITY = 'cpan:STEVAN'; |
9 | |
10 | use base 'Moose::Meta::Method::Accessor::Native::Array'; |
11 | |
12 | sub _generate_method { |
13 | my $self = shift; |
14 | |
15 | my $inv = '$self'; |
16 | |
17 | my $code = 'sub {'; |
18 | $code .= "\n" . $self->_inline_pre_body(@_); |
19 | |
20 | $code .= "\n" . 'my $self = shift;'; |
f5f08b5f |
21 | $code .= "\n" . $self->_inline_curried_arguments; |
f7fd22b6 |
22 | $code .= "\n" . $self->_inline_process_arguments; |
23 | |
24 | $code |
25 | .= "\n" |
26 | . $self->_inline_throw_error( |
27 | q{"Cannot assign a value to a read-only accessor"}, 'data => \@_' ) |
28 | . ' if @_ > 1;'; |
29 | |
30 | $code .= "\n" . $self->_inline_check_lazy($inv); |
31 | $code .= "\n" . $self->_inline_post_body(@_); |
32 | |
33 | my $slot_access = $self->_inline_get($inv); |
34 | |
35 | $code .= "\n" . 'return ' . $self->_return_value($slot_access) . ';'; |
36 | $code .= "\n}"; |
37 | |
38 | return $code; |
39 | } |
40 | |
41 | sub _inline_process_arguments { q{} } |
42 | |
43 | 1; |