0380f5904919a927c56a8c7459037d73906bb4d3
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Array.pm
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
15 sub _inline_curried_arguments {
16     my $self = shift;
17
18     return q{} unless @{ $self->curried_arguments };
19
20     return "\@_ = ( \@curried, \@_ );";
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;