Commit | Line | Data |
f7fd22b6 |
1 | package Moose::Meta::Method::Accessor::Native::Array; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use B; |
7 | use Scalar::Util qw( looks_like_number ); |
8 | |
9 | our $VERSION = '1.13'; |
10 | $VERSION = eval $VERSION; |
11 | our $AUTHORITY = 'cpan:STEVAN'; |
12 | |
13 | use base 'Moose::Meta::Method::Accessor::Native'; |
14 | |
f5f08b5f |
15 | sub _inline_curried_arguments { |
f7fd22b6 |
16 | my $self = shift; |
17 | |
f5f08b5f |
18 | return q{} unless @{ $self->curried_arguments }; |
f7fd22b6 |
19 | |
f5f08b5f |
20 | return "\@_ = ( \@curried, \@_ );"; |
f7fd22b6 |
21 | } |
22 | |
23 | sub _inline_check_constraint { |
24 | my $self = shift; |
25 | |
26 | return q{} unless $self->_constraint_must_be_checked; |
27 | |
28 | return $self->SUPER::_inline_check_constraint(@_); |
29 | } |
30 | |
31 | sub _constraint_must_be_checked { |
32 | my $self = shift; |
33 | |
34 | my $attr = $self->associated_attribute; |
35 | |
36 | return $attr->has_type_constraint |
37 | && ( $attr->type_constraint->name ne 'ArrayRef' |
38 | || ( $attr->should_coerce && $attr->type_constraint->has_coercion ) ); |
39 | } |
40 | |
41 | 1; |