1 package Moose::Meta::Method::Accessor::Native::Array;
7 use Scalar::Util qw( looks_like_number );
10 $VERSION = eval $VERSION;
11 our $AUTHORITY = 'cpan:STEVAN';
13 use base 'Moose::Meta::Method::Accessor::Native';
15 sub _value_needs_copy {
18 return @{ $self->curried_arguments };
21 sub _inline_copy_value {
24 return q{} unless $self->_value_needs_copy;
26 my $curry = join ', ',
27 map { looks_like_number($_) ? $_ : B::perlstring($_) }
28 @{ $self->curried_arguments };
30 return "my \@val = ( $curry, \@_ );";
33 sub _inline_check_constraint {
36 return q{} unless $self->_constraint_must_be_checked;
38 return $self->SUPER::_inline_check_constraint(@_);
41 sub _constraint_must_be_checked {
44 my $attr = $self->associated_attribute;
46 return $attr->has_type_constraint
47 && ( $attr->type_constraint->name ne 'ArrayRef'
48 || ( $attr->should_coerce && $attr->type_constraint->has_coercion ) );