Actually unshift curried args into @_
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Array.pm
CommitLineData
f7fd22b6 1package Moose::Meta::Method::Accessor::Native::Array;
2
3use strict;
4use warnings;
5
6use B;
7use Scalar::Util qw( looks_like_number );
8
9our $VERSION = '1.13';
10$VERSION = eval $VERSION;
11our $AUTHORITY = 'cpan:STEVAN';
12
13use base 'Moose::Meta::Method::Accessor::Native';
14
f5f08b5f 15sub _inline_curried_arguments {
f7fd22b6 16 my $self = shift;
17
f5f08b5f 18 return q{} unless @{ $self->curried_arguments };
f7fd22b6 19
aada334d 20 return 'unshift @_, @curried;'
f7fd22b6 21}
22
23sub _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
31sub _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
411;