« blib/lib/Moose/Exception/CannotMakeMetaclassCompatible.pm
↑ Summary
blib/lib/Moose/Meta/Role/Method.pm »
| 1 | package Moose::Meta::Method::Accessor::Native::Array::insert; | ||||||||||
| 2 | 4 | our $VERSION = '2.4001'; | |||||||||
| 3 | |||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 4 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 4 | with 'Moose::Meta::Method::Accessor::Native::Array::Writer'; | |||||||||
| 10 | |||||||||||
| 11 | 20 | ▶ | sub _minimum_arguments { 2 } | ||||||||
|
Subroutine
_minimum_arguments: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 20 | ▶ | sub _maximum_arguments { 2 } | ||||||||
|
Subroutine
_maximum_arguments: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 9 | ▶ | sub _adds_members { 1 } | ||||||||
|
Subroutine
_adds_members: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 20 | ▶ | sub _potential_value { | ||||||||
|
Subroutine
_potential_value: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 20 | my $self = shift; | |||||||||
| 19 | 20 | my ($slot_access) = @_; | |||||||||
| 20 | |||||||||||
| 21 | 20 | return '(do { ' | |||||||||
| 22 | . 'my @potential = @{ (' . $slot_access . ') }; ' | ||||||||||
| 23 | . 'splice @potential, $_[0], 0, $_[1]; ' | ||||||||||
| 24 | . '\@potential; ' | ||||||||||
| 25 | . '})'; | ||||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | # We need to override this because while @_ can be written to, we cannot write | ||||||||||
| 29 | # directly to $_[1]. | ||||||||||
| 30 | 20 | ▶ | sub _inline_coerce_new_values { | ||||||||
|
Subroutine
_inline_coerce_new_values: called CC=3 SCAR=11.0
| |||||||||||
| 31 | 20 | my $self = shift; | |||||||||
| 32 | |||||||||||
| 33 | 20 | ▶ | return unless $self->associated_attribute->should_coerce; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | |||||||||||
| 35 | 4 | ▶ | return unless $self->_tc_member_type_can_coerce; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | |||||||||||
| 37 | 1 | return '@_ = ($_[0], $member_coercion->($_[1]));'; | |||||||||
| 38 | }; | ||||||||||
| 39 | |||||||||||
| 40 | 9 | ▶ | sub _new_members { '$_[1]' } | ||||||||
|
Subroutine
_new_members: called CC=1 SCAR=0.0
| |||||||||||
| 41 | |||||||||||
| 42 | 12 | ▶ | sub _inline_optimized_set_new_value { | ||||||||
|
Subroutine
_inline_optimized_set_new_value: called CC=1 SCAR=0.0
| |||||||||||
| 43 | 12 | my $self = shift; | |||||||||
| 44 | 12 | my ($inv, $new, $slot_access) = @_; | |||||||||
| 45 | |||||||||||
| 46 | 12 | return 'splice @{ (' . $slot_access . ') }, $_[0], 0, $_[1];'; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 40 | ▶ | sub _return_value { | ||||||||
|
Subroutine
_return_value: called CC=1 SCAR=0.0
| |||||||||||
| 50 | 40 | my $self = shift; | |||||||||
| 51 | 40 | my ($slot_access) = @_; | |||||||||
| 52 | |||||||||||
| 53 | 40 | return $slot_access . '->[ $_[0] ]'; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 4 | ▶ | no Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 57 | |||||||||||
| 58 | 4 | 1; | |||||||||