| 1 | 2 | ▶ | use strict; # redundant, but quiets perlcritic | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 2 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | package MooX::StrictConstructor::Role::BuildAll; | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 2 | our $VERSION = '0.013'; | |||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 2 | ▶ | use Moo::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 2 | has _constructor_generator => ( | |||||||||||||||||||
| 10 | is => 'rw', | ||||||||||||||||||||
| 11 | weaken => 1, | ||||||||||||||||||||
| 12 | ); | ||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 1 | ▶ | around buildall_body_for => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.1
| |||||||||||||||||||||
| 15 | 1 | my ($orig, $self, $into, $me, $args, @extra) = @_; | |||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 1 | my $con = $self->_constructor_generator; | |||||||||||||||||||
| 18 | 1 | my $fake_BUILD = $con->can('_fake_BUILD'); | |||||||||||||||||||
| 19 | 1 | my $real_build = ! do { | |||||||||||||||||||
| 20 | 2 | ▶ | no strict 'refs'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 21 | 1 | ▶ | defined &{"${into}::BUILD"} && \&{"${into}::BUILD"} == $fake_BUILD; | ||||||||||||||||||
|
Condition33%1/3
defined &{"${into}::BUILD";} && \&{"${into}::BUILD";} == $fake_BUILD
MC/DC0%0/2
defined &{"${into}::BUILD";} && \&{"${into}::BUILD";} == $fake_BUILD
defined &{"${into}::BUILD";}
\&{"${into}::BUILD";} == $fake_BUILD
Truth table33%1/3
A && B
A= defined &{"${into}::BUILD";}B= \&{"${into}::BUILD";} == $fake_BUILD
| |||||||||||||||||||||
| 22 | }; | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 1 | my $code = ''; | |||||||||||||||||||
| 25 | 1 | ▶ | if ($real_build) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 26 | 1 | $code .= $self->$orig($into, $me, $args, @extra); | |||||||||||||||||||
| 27 | } | ||||||||||||||||||||
| 28 | 1 | ▶ | my $arg = $args =~ /^\$\w+(?:\[[0-9]+\])?$/ ? $args : "($args)[0]"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 29 | 1 | $code .= "do {\n" . $con->_cap_call($con->_check_strict($con->all_attribute_specs, $arg)) . "},\n"; | |||||||||||||||||||
| 30 | 1 | return $code; | |||||||||||||||||||
| 31 | 2 | }; | |||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 2 | 1; | |||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | __END__ | ||||||||||||||||||||