Commit | Line | Data |
5df54980 |
1 | package Moose::Meta::Method::Accessor::Native::Reader; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
bb8ef151 |
6 | our $VERSION = '1.9900'; |
5df54980 |
7 | $VERSION = eval $VERSION; |
8 | our $AUTHORITY = 'cpan:STEVAN'; |
9 | |
8b9641b8 |
10 | use Moose::Role; |
11 | |
12 | with 'Moose::Meta::Method::Accessor::Native'; |
13 | |
14 | requires '_return_value'; |
5df54980 |
15 | |
16 | sub _generate_method { |
17 | my $self = shift; |
18 | |
53a4677c |
19 | my $inv = '$self'; |
1e2c801e |
20 | my $slot_access = $self->_get_value($inv); |
e7724627 |
21 | |
53a4677c |
22 | return ( |
23 | 'sub {', |
53a4677c |
24 | 'my ' . $inv . ' = shift;', |
25 | $self->_inline_curried_arguments, |
1e2c801e |
26 | $self->_inline_reader_core($inv, $slot_access, @_), |
53a4677c |
27 | '}', |
28 | ); |
e7724627 |
29 | } |
30 | |
1e2c801e |
31 | sub _inline_reader_core { |
53a4677c |
32 | my $self = shift; |
33 | my ($inv, $slot_access, @extra) = @_; |
34 | |
35 | return ( |
36 | $self->_inline_check_argument_count, |
37 | $self->_inline_process_arguments($inv, $slot_access), |
38 | $self->_inline_check_arguments, |
ec86bdff |
39 | $self->_inline_check_lazy($inv, '$type_constraint', '$type_constraint_obj'), |
53a4677c |
40 | $self->_inline_return_value($slot_access), |
41 | ); |
5df54980 |
42 | } |
43 | |
53a4677c |
44 | sub _inline_process_arguments { return } |
e7724627 |
45 | |
53a4677c |
46 | sub _inline_check_arguments { return } |
5df54980 |
47 | |
8b9641b8 |
48 | no Moose::Role; |
49 | |
5df54980 |
50 | 1; |