| 1 | 40 | ▶ | use 5.008008; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 40 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 40 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | package MooX::Press; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 40 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 40 | our $VERSION = '0.086'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 40 | ▶ | use Types::Standard 1.010000 -is, -types; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 40 | ▶ | use Types::TypeTiny qw(ArrayLike HashLike); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 40 | ▶ | use Type::Registry (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 40 | ▶ | use Exporter::Tiny qw(mkopt); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 40 | ▶ | use Import::Into; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 40 | ▶ | use match::simple qw(match); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 40 | ▶ | use Module::Runtime qw(use_module); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 40 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 311 | ▶ | sub make_absolute_package_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_absolute_package_name: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 311 | my $p = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 311 | ▶ | $] lt '5.018' ? "main::$p" : "::$p"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 40 | ▶ | if ( $] lt '5.010' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | require UNIVERSAL::DOES; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # Options not to carry up into subclasses; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # mostly because subclasses inherit behaviour anyway. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 40 | my @delete_keys = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | subclass | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | has | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | extends | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | overload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | factory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | coerce | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | around | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | before | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | after | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | type_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | can | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | type_library_can | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | factory_package_can | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | abstract | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | multimethod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | symmethod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | multifactory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 1029 | ▶ | my $_handle_list = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=19.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 1029 | my ($thing) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | return () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 1029 | ▶ | unless defined $thing; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 885 | ▶ | return $thing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | if is_Str $thing; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 610 | ▶ | return %$thing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | if is_HashRef $thing; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 246 | ▶ | return @$thing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | if is_ArrayRef $thing; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | goto $thing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | if is_CodeRef $thing; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | die "Unexepcted thing; got $thing"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 40 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 220 | ▶ | my $_handle_list_add_nulls = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 220 | my ($thing) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 220 | ▶ | return map @$_, @{mkopt $thing} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | if is_ArrayRef $thing; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 129 | goto $_handle_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 40 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 40 | my %_cached_moo_helper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 49 | ▶ | sub _apply_default_options { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_apply_default_options: called CC=15 SCAR=29.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 49 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 49 | my $opts = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 49 | ▶ | $opts->{default_is} ||= 'ro'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opts->{"default_is"} ||= "ro"
MC/DC0%0/1
$opts->{"default_is"} ||= "ro"
$opts->{"default_is"}
Truth table50%1/2
A
A= $opts->{"default_is"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 49 | ▶ | $opts->{toolkit} ||= $ENV{'PERL_MOOX_PRESS_TOOLKIT'} || 'Moo'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition60%3/5
$opts->{"toolkit"} ||= $ENV{"PERL_MOOX_PRESS_TOOLKIT"} || "Moo"
$ENV{'PERL_MOOX_PRESS_TOOLKIT'} || 'Moo'
MC/DC0%0/2
$opts->{"toolkit"} ||= $ENV{"PERL_MOOX_PRESS_TOOLKIT"} || "Moo"
$opts->{"toolkit"}
$ENV{'PERL_MOOX_PRESS_TOOLKIT'}
Truth table33%1/3
A ||= B
A= $opts->{"toolkit"}B= $ENV{'PERL_MOOX_PRESS_TOOLKIT'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | $opts->{version} = $opts->{caller}->VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 49 | ▶ | unless exists $opts->{version}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 40 | ▶ | $opts->{authority} = do { no strict 'refs'; no warnings 'once'; ${$opts->{caller}."::AUTHORITY"} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 49 | ▶ | unless exists $opts->{authority}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 49 | ▶ | unless (exists $opts->{prefix}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 10 | $opts->{prefix} = $opts->{caller}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 10 | ▶ | if ($opts->{prefix} eq 'main') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 2 | $opts->{prefix} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 49 | my $no_warn = exists($opts->{factory_package}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | $opts->{factory_package} = defined($opts->{prefix}) ? $opts->{prefix} : 'Local' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 49 | ▶ | unless exists $opts->{factory_package}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 49 | ▶ | if (!$no_warn and defined($opts->{factory_package}) and $opts->{factory_package} eq 'Local') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
not $no_warn and defined $opts->{"factory_package"} and $opts->{"factory_package"} eq "Local"
not $no_warn and defined $opts->{"factory_package"}
MC/DC0%0/3
not $no_warn and defined $opts->{"factory_package"} and $opts->{"factory_package"} eq "Local"
not $no_warn
defined $opts->{"factory_package"}
$opts->{"factory_package"} eq "Local"
Truth table50%2/4
not(A) and B and C
A= not $no_warnB= defined $opts->{"factory_package"}C= $opts->{"factory_package"} eq "Local"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | require FindBin; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | if ($FindBin::Script ne '-e') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | Carp::carp('Using "Local" as factory; please set prefix or factory_package'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 49 | ▶ | unless (exists $opts->{type_library}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 49 | $opts->{type_library} = $builder->qualify_name('Types', $opts->{prefix}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 49 | ▶ | sub import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=43 SCAR=38.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 49 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 49 | my $caller = caller; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 49 | ▶ | my %opts = @_==1 ? shift->$_handle_list_add_nulls : @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 49 | ▶ | $opts{caller} ||= $caller; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$opts{"caller"} ||= $caller
MC/DC0%0/2
$opts{"caller"} ||= $caller
$opts{"caller"}
$caller
Truth table66%2/3
A ||= B
A= $opts{"caller"}B= $caller
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 49 | ▶ | $opts{caller_file} ||= [caller]->[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$opts{"caller_file"} ||= [caller]->[1]
MC/DC0%0/2
$opts{"caller_file"} ||= [caller]->[1]
$opts{"caller_file"}
[caller]->[1]
Truth table33%1/3
A ||= B
A= $opts{"caller_file"}B= [caller]->[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 49 | $builder->_apply_default_options(\%opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 49 | $builder->munge_options(\%opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 49 | $builder->_mark_package_as_loaded('factory package' => $opts{factory_package}, \%opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 49 | my @role_generators = @{ mkopt $opts{role_generator} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 49 | my @class_generators = @{ mkopt $opts{class_generator} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 49 | my @roles = @{ mkopt $opts{role} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 49 | my @classes = @{ mkopt $opts{class} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | # Canonicalize these now, saves repeatedly doing it later! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 49 | for my $pkg (@role_generators) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 2 | ▶ | if (is_CodeRef($pkg->[1]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
is_CodeRef($pkg->[1]) or is_HashRef($pkg->[1]) and is_CodeRef($pkg->[1]{"code"})
is_HashRef($pkg->[1]) and is_CodeRef($pkg->[1]{"code"})
MC/DC0%0/3
is_CodeRef($pkg->[1]) or is_HashRef($pkg->[1]) and is_CodeRef($pkg->[1]{"code"})
is_CodeRef($pkg->[1])
is_HashRef($pkg->[1])
is_CodeRef($pkg->[1]{"code"})
Truth table50%2/4
A or B and C
A= is_CodeRef($pkg->[1])B= is_HashRef($pkg->[1])C= is_CodeRef($pkg->[1]{"code"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | or is_HashRef($pkg->[1]) && is_CodeRef($pkg->[1]{code})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 2 | $pkg->[1] = { generator => $pkg->[1] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 2 | $pkg->[1] = { $pkg->[1]->$_handle_list }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 2 | $builder->munge_role_generator_options($pkg->[1], \%opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 49 | for my $pkg (@class_generators) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | ▶ | if (is_CodeRef($pkg->[1]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
is_CodeRef($pkg->[1]) or is_HashRef($pkg->[1]) and is_CodeRef($pkg->[1]{"code"})
is_HashRef($pkg->[1]) and is_CodeRef($pkg->[1]{"code"})
MC/DC0%0/3
is_CodeRef($pkg->[1]) or is_HashRef($pkg->[1]) and is_CodeRef($pkg->[1]{"code"})
is_CodeRef($pkg->[1])
is_HashRef($pkg->[1])
is_CodeRef($pkg->[1]{"code"})
Truth table50%2/4
A or B and C
A= is_CodeRef($pkg->[1])B= is_HashRef($pkg->[1])C= is_CodeRef($pkg->[1]{"code"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | or is_HashRef($pkg->[1]) && is_CodeRef($pkg->[1]{code})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 2 | $pkg->[1] = { generator => $pkg->[1] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 2 | $pkg->[1] = { $pkg->[1]->$_handle_list }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 2 | $builder->munge_class_generator_options($pkg->[1], \%opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 49 | for my $pkg (@roles) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 57 | $pkg->[1] = { $pkg->[1]->$_handle_list }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | # qualify names in role list early | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | $pkg->[0] = make_absolute_package_name( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | $builder->qualify_name($pkg->[0], exists($pkg->[1]{prefix})?$pkg->[1]{prefix}:$opts{prefix}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 57 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 57 | $builder->munge_role_options($pkg->[1], \%opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 49 | for my $pkg (@classes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 69 | $pkg->[1] = { $pkg->[1]->$_handle_list }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 69 | ▶ | if (defined $pkg->[1]{extends} and not ref $pkg->[1]{extends}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $pkg->[1]{"extends"} and not ref $pkg->[1]{"extends"}
MC/DC100%2/2
defined $pkg->[1]{"extends"} and not ref $pkg->[1]{"extends"}
defined $pkg->[1]{"extends"}
not ref $pkg->[1]{"extends"}
Truth table100%3/3
A and not(B)
A= defined $pkg->[1]{"extends"}B= not ref $pkg->[1]{"extends"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 9 | $pkg->[1]{extends} = [$pkg->[1]{extends}]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 69 | $builder->munge_class_options($pkg->[1], \%opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 49 | ▶ | if ($opts{type_library}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 49 | $builder->prepare_type_library($opts{type_library}, %opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | # no type for role generators | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 49 | for my $pkg (@class_generators) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 2 | $builder->make_type_for_class_generator($pkg->[0], %opts, %{$pkg->[1]}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 49 | for my $pkg (@roles) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 57 | $builder->make_type_for_role($pkg->[0], %opts, %{$pkg->[1]}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 49 | for my $pkg (@classes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 69 | $builder->make_type_for_class($pkg->[0], %opts, %{$pkg->[1]}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 49 | my $reg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 49 | ▶ | if ($opts{factory_package}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 47 | require Type::Registry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 47 | $reg = 'Type::Registry'->for_class($opts{factory_package}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 47 | $reg->add_types($_) for ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | $opts{type_library}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | qw( Types::Standard Types::Common::Numeric Types::Common::String Types::TypeTiny ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 49 | ▶ | if (defined $opts{'factory_package'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 47 | my %methods; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 47 | ▶ | my $method_installer = $opts{toolkit_install_methods} || ("install_methods"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opts{'toolkit_install_methods'} || 'install_methods'
MC/DC0%0/1
$opts{'toolkit_install_methods'} || 'install_methods'
$opts{'toolkit_install_methods'}
Truth table50%1/2
A
A= $opts{'toolkit_install_methods'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 47 | %methods = delete($opts{factory_package_can})->$_handle_list_add_nulls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 47 | ▶ | if ( my $p = $opts{'prefix'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | $methods{qualify} ||= sub { $builder->qualify_name($_[1], $p) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 47 | ▶ | unless exists &{$opts{'factory_package'}.'::qualify'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$methods{"qualify"} ||= sub {
$builder->qualify_name($_[1], $p);
}
MC/DC0%0/2
$methods{"qualify"} ||= sub {
$builder->qualify_name($_[1], $p);
}
$methods{"qualify"}
sub {
$builder->qualify_name($_[1], $p);
}
Truth table33%1/3
A ||= B
A= $methods{"qualify"}B= sub {
$builder->qualify_name($_[1], $p);
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 2 | ▶ | $methods{get_class} ||= sub { shift; $builder->_get_class($p, @_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 47 | ▶ | unless exists &{$opts{'factory_package'}.'::get_class'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$methods{"get_class"} ||= sub {
shift();
$builder->_get_class($p, @_);
}
MC/DC0%0/2
$methods{"get_class"} ||= sub {
shift();
$builder->_get_class($p, @_);
}
$methods{"get_class"}
sub {
shift();
$builder->_get_class($p, @_);
}
Truth table33%1/3
A ||= B
A= $methods{"get_class"}B= sub {
shift();
$builder->_get_class($p, @_);
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 1 | ▶ | $methods{get_role} ||= sub { shift; $builder->_get_role($p, @_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 47 | ▶ | unless exists &{$opts{'factory_package'}.'::get_role'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$methods{"get_role"} ||= sub {
shift();
$builder->_get_role($p, @_);
}
MC/DC0%0/2
$methods{"get_role"} ||= sub {
shift();
$builder->_get_role($p, @_);
}
$methods{"get_role"}
sub {
shift();
$builder->_get_role($p, @_);
}
Truth table33%1/3
A ||= B
A= $methods{"get_role"}B= sub {
shift();
$builder->_get_role($p, @_);
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 47 | ▶ | $builder->$method_installer($opts{'factory_package'}, \%methods) if keys %methods; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 47 | %methods = delete($opts{type_library_can})->$_handle_list_add_nulls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 47 | ▶ | $builder->$method_installer($opts{type_library}, \%methods) if keys %methods; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 47 | push @{ $opts{'factory_package'} . '::ISA' }, 'Exporter::Tiny'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 49 | my %modifiers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | $opts{$_} && ($modifiers{$_} = delete $opts{$_}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 49 | ▶ | for qw/ before after around can with constant symmethod multimethod extends /; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 49 | for my $pkg (@roles) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 57 | $builder->do_coercions_for_role($pkg->[0], %opts, reg => $reg, %{$pkg->[1]}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 49 | for my $pkg (@classes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 69 | $builder->do_coercions_for_class($pkg->[0], %opts, reg => $reg, %{$pkg->[1]}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 49 | for my $pkg (@role_generators) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 2 | $builder->make_role_generator($pkg->[0], %opts, %{$pkg->[1]}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 49 | for my $pkg (@class_generators) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 2 | $builder->make_class_generator($pkg->[0], %opts, %{$pkg->[1]}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 49 | for my $pkg (@roles) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 57 | $builder->make_role($pkg->[0], _parent_opts => \%opts, _roles => \@roles, %opts, %{$pkg->[1]}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 49 | for my $pkg (@classes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 68 | $builder->make_class($pkg->[0], _parent_opts => \%opts, _classes => \@classes, _roles => \@roles, %opts, %{$pkg->[1]}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 48 | ▶ | if (keys %modifiers) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 2 | $builder->patch_package( $opts{'factory_package'}, prefix => $opts{'prefix'}, %modifiers ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 48 | %_cached_moo_helper = (); # cleanups | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 303 | ▶ | sub _mark_package_as_loaded { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mark_package_as_loaded: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 303 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 303 | my ($kind, $pkg, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 303 | ▶ | defined $pkg or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 301 | ▶ | $INC{Module::Runtime::module_notional_filename($pkg)} = $opts->{caller_file} || 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$opts->{'caller_file'} || 1
MC/DC100%1/1
$opts->{'caller_file'} || 1
$opts->{'caller_file'}
Truth table100%2/2
A
A= $opts->{'caller_file'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 301 | ▶ | if (defined $opts->{factory_package}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 290 | my $idx = \%{ $opts->{factory_package} . '::PACKAGES' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 290 | $idx->{$pkg} = $kind; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 49 | ▶ | sub munge_options { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
munge_options: called CC=8 SCAR=21.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 49 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 49 | my ($opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 49 | for my $key (sort keys %$opts) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 548 | ▶ | if ($key =~ /^(class|role|class_generator|role_generator):((?:::)?[^:].*)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 55 | my ($kind, $pkg) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 55 | my $val = delete $opts->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 55 | ▶ | if (ref $val) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 53 | ▶ | push @{ $opts->{$kind} ||= [] }, $pkg, $val; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$opts->{$kind} ||= []
MC/DC100%1/1
$opts->{$kind} ||= []
$opts->{$kind}
Truth table100%2/2
A
A= $opts->{$kind}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | ▶ | elsif ($val eq 1 or not defined $val) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$val eq 1 or not defined $val
MC/DC0%0/2
$val eq 1 or not defined $val
$val eq 1
not defined $val
Truth table33%1/3
A or not(B)
A= $val eq 1B= not defined $val
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 2 | ▶ | push @{ $opts->{$kind} ||= [] }, $pkg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$opts->{$kind} ||= []
MC/DC100%1/1
$opts->{$kind} ||= []
$opts->{$kind}
Truth table100%2/2
A
A= $opts->{$kind}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | $builder->croak("$kind\:$pkg shortcut should be '1' or reference"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 49 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 57 | ▶ | sub munge_role_options { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
munge_role_options: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 57 | shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 57 | my ($roleopts, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 57 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 69 | ▶ | sub munge_class_options { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
munge_class_options: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 69 | shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 69 | my ($classopts, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 69 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 2 | ▶ | sub munge_class_generator_options { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
munge_class_generator_options: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 2 | shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 2 | my ($cgenopts, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 2 | ▶ | sub munge_role_generator_options { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
munge_role_generator_options: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 2 | shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 2 | my ($rgenopts, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 906 | ▶ | sub qualify_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
qualify_name: called CC=6 SCAR=18.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 906 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 906 | my ($name, $prefix, $parent) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 906 | my $sigil = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 906 | ▶ | if ($name =~ /^[@%\$]/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | $sigil = substr $name, 0, 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | $name = substr $name, 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 906 | ▶ | $name = join("::", '', $parent->$_handle_list, $1) if (defined $parent and $name =~ /^\+(.+)/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $parent and $name =~ /^\+(.+)/
MC/DC100%2/2
defined $parent and $name =~ /^\+(.+)/
defined $parent
$name =~ /^\+(.+)/
Truth table100%3/3
A and B
A= defined $parentB= $name =~ /^\+(.+)/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 906 | ▶ | return $sigil.$2 if $name =~ /^(main)?::(.+)$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 618 | ▶ | $prefix ? $sigil.join("::", $prefix, $name) : $sigil.$name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 401 | ▶ | sub type_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type_name: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 401 | shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 401 | my ($name, $prefix) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 401 | ▶ | $name =~ s/^(main)?::// while $name =~ /^(main)?::/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 401 | ▶ | $prefix = '' unless defined $prefix; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 401 | my $stub = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 401 | ▶ | if (length $prefix and lc substr($name, 0, length $prefix) eq lc $prefix) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
length $prefix and lc substr($name, 0, length $prefix) eq lc $prefix
MC/DC100%2/2
length $prefix and lc substr($name, 0, length $prefix) eq lc $prefix
length $prefix
lc substr($name, 0, length $prefix) eq lc $prefix
Truth table100%3/3
A and B
A= length $prefixB= lc substr($name, 0, length $prefix) eq lc $prefix
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 380 | $stub = substr($name, 2 + length $prefix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 401 | ▶ | $stub =~ s/^(main)?::// while $stub =~ /^(main)?::/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 401 | $stub =~ s/::/_/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 401 | $stub; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 3 | ▶ | sub _helper_for_get_class { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_helper_for_get_class: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 3 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 3 | my $pfx = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 3 | my @packages; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 3 | ▶ | while ( @_ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 5 | my $qname = $me->qualify_name( shift, $pfx ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 5 | ▶ | push @packages, ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | ref($_[0]) ? $qname->generate_package( shift->$_handle_list ) : $qname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 3 | return @packages; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | my %_anony_counter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 2 | ▶ | sub _get_class { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_class: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 2 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 2 | my ($pfx) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 2 | my ($class, @roles) = $me->_helper_for_get_class( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 2 | ▶ | return make_absolute_package_name($class) unless @roles; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 40 | ▶ | no warnings qw( uninitialized numeric ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | my $new_class = $class->can('with_traits') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | ? $class->with_traits( @roles ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | : $me->make_class( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | make_absolute_package_name( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | sprintf('%s::__WITH_TRAITS__::__GEN%06d__', $class, ++$_anony_counter{$class}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | extends => make_absolute_package_name($class), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | with => [ map make_absolute_package_name($_), @roles ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 40 | ▶ | prefix => do { no strict 'refs'; ${"$class\::PREFIX"} } || $pfx, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Condition50%1/2
do {
${"${class}::TOOLKIT";}
} || 'Moo'
MC/DC0%0/1
do {
${"${class}::TOOLKIT";}
} || 'Moo'
do {
${"${class}::TOOLKIT";}
}
Truth table50%1/2
A
A= do {
${"${class}::TOOLKIT";}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | factory => $class->FACTORY, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 40 | ▶ | toolkit => do { no strict 'refs'; ${"$class\::TOOLKIT"} } || 'Moo', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
Branch: 1 branch
Condition33%1/3
do {
no strict 'refs';
${"${class}::PREFIX";}
} || $pfx
MC/DC0%0/2
do {
no strict 'refs';
${"${class}::PREFIX";}
} || $pfx
do {
no strict 'refs';
${"${class}::PREFIX";}
}
$pfx
Truth table33%1/3
A || B
A= do {
no strict 'refs';
${"${class}::PREFIX";}
}B= $pfx
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 1 | return make_absolute_package_name($new_class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 1 | ▶ | sub _get_role { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_role: called CC=4 SCAR=17.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 1 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 1 | my ($pfx) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 1 | my (@roles) = $me->_helper_for_get_class( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 1 | ▶ | return make_absolute_package_name($roles[0]) if @roles==1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 40 | ▶ | no warnings qw( uninitialized numeric ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | my $new_role = $me->make_role( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | make_absolute_package_name( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | sprintf('%s::__WITH_TRAITS__::__GEN%06d__', $roles[0], ++$_anony_counter{$roles[0]}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | with => [ map make_absolute_package_name($_), @roles ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | prefix => do { no strict 'refs'; ${$roles[0]."::PREFIX"} } || $pfx, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.7
Condition0%0/2
do {
${$roles[0] . '::TOOLKIT';}
} || 'Moo'
MC/DC0%0/1
do {
${$roles[0] . '::TOOLKIT';}
} || 'Moo'
do {
${$roles[0] . '::TOOLKIT';}
}
Truth table0%0/2
A
A= do {
${$roles[0] . '::TOOLKIT';}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | toolkit => do { no strict 'refs'; ${$roles[0]."::TOOLKIT"} } || 'Moo', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Condition0%0/3
do {
no strict 'refs';
${$roles[0] . '::PREFIX';}
} || $pfx
MC/DC0%0/2
do {
no strict 'refs';
${$roles[0] . '::PREFIX';}
} || $pfx
do {
no strict 'refs';
${$roles[0] . '::PREFIX';}
}
$pfx
Truth table0%0/3
A || B
A= do {
no strict 'refs';
${$roles[0] . '::PREFIX';}
}B= $pfx
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | return make_absolute_package_name($new_role); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | sub croak { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
croak: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | goto \&Carp::croak; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 40 | my $none; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 49 | ▶ | sub prepare_type_library { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_type_library: called CC=7 SCAR=19.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 40 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 49 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 49 | my ($lib, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 49 | ▶ | return if exists &{"$lib\::_mooxpress_add_type"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 47 | my ($version, $authority) = ($opts{version}, $opts{authority}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 47 | my %types_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 47 | require Type::Tiny::Role; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 47 | require Type::Tiny::Class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 47 | require Type::Registry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 47 | use_module('Type::Library')->import::into($lib, -base); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 47 | $builder->_mark_package_as_loaded('type library' => $lib, \%opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 191 | ▶ | my $adder = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 191 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 191 | my ($name, $kind, $target, $coercions) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 191 | ▶ | return if $types_hash{$kind}{$target}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 190 | my $tc_class = 'Type::Tiny::' . ucfirst($kind); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 190 | my $tc_obj = $tc_class->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | name => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | library => $me, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | $kind => $target, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 190 | $types_hash{$kind}{$target} = $tc_obj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 190 | $types_hash{'any'}{$target} = $tc_obj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 190 | $me->add_type($tc_obj); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | Type::Registry->for_class($opts{factory_package})->add_type($tc_obj) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 190 | ▶ | if defined $opts{factory_package}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 190 | ▶ | if ($coercions) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 7 | ▶ | $none ||= ~Any; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$none ||= ~&Any()
MC/DC0%0/2
$none ||= ~&Any()
$none
~&Any()
Truth table33%1/3
A ||= B
A= $noneB= ~&Any()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 7 | $tc_obj->coercion->add_type_coercions($none, 'die()'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 47 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 224 | ▶ | my $getter = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=20.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 224 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 224 | my ($kind, $target) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 224 | ▶ | if ($target =~ /^([@%])(.+)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 6 | my $sigil = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 6 | $target = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 6 | ▶ | if ($sigil eq '@') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | return ArrayRef->of($types_hash{$kind}{$target}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 6 | ▶ | if $types_hash{$kind}{$target}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | elsif ($sigil eq '%') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | return HashRef->of($types_hash{$kind}{$target}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | if $types_hash{$kind}{$target}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 218 | $types_hash{$kind}{$target}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 47 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 47 | ▶ | if (defined $opts{'factory_package'} or not exists $opts{'factory_package'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $opts{"factory_package"} or not exists $opts{"factory_package"}
MC/DC50%1/2
defined $opts{"factory_package"} or not exists $opts{"factory_package"}
defined $opts{"factory_package"}
not exists $opts{"factory_package"}
Truth table66%2/3
A or not(B)
A= defined $opts{"factory_package"}B= not exists $opts{"factory_package"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 45 | require B; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | eval( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | sprintf ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | package %s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | sub type_library { %s }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | sub get_type_for_package { shift->type_library->get_type_for_package(@_) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | ', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 45 | ▶ | $opts{'factory_package'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_type_for_package: called CC=1 SCAR=0.1
Subroutine
type_library: called CC=1 SCAR=0.1
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | B::perlstring($lib), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | ) or $builder->croak("Could not install type library methods into factory package: $@"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 47 | *{"$lib\::_mooxpress_add_type"} = $adder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 47 | *{"$lib\::get_type_for_package"} = $getter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 47 | ▶ | ${"$lib\::VERSION"} = $version if defined $version; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 47 | ▶ | ${"$lib\::AUTHORITY"} = $authority if defined $authority; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 59 | ▶ | sub make_type_for_role { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_type_for_role: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 59 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 59 | my ($name, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 59 | ▶ | return unless $opts{'type_library'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 59 | ▶ | $builder->croak("Roles ($name) cannnot extend things") if $opts{extends}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 59 | $builder->_make_type($name, %opts, is_role => 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 132 | ▶ | sub make_type_for_class { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_type_for_class: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 132 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 132 | my ($name, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 132 | ▶ | return unless $opts{'type_library'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 132 | $builder->_make_type($name, %opts, is_role => 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 2 | ▶ | sub make_type_for_class_generator { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_type_for_class_generator: called CC=6 SCAR=19.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 2 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 2 | my ($name, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 2 | my $qname = $builder->qualify_name($name, $opts{prefix}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 2 | ▶ | if ($opts{'type_library'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | my $class_type_name = $opts{'class_type_name'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 2 | ▶ | || sprintf('%sClass', $builder->type_name($qname, $opts{'prefix'})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$opts{'class_type_name'} || sprintf('%sClass', $builder->type_name($qname, $opts{'prefix'}))
MC/DC0%0/2
$opts{'class_type_name'} || sprintf('%sClass', $builder->type_name($qname, $opts{'prefix'}))
$opts{'class_type_name'}
sprintf('%sClass', $builder->type_name($qname, $opts{'prefix'}))
Truth table33%1/3
A || B
A= $opts{'class_type_name'}B= sprintf('%sClass', $builder->type_name($qname, $opts{'prefix'}))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 2 | my $class_type = $opts{'type_library'}->add_type({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | name => $class_type_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | parent => ClassName, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | constraint => sprintf('$_->can("GENERATOR") && ($_->GENERATOR eq %s)', B::perlstring($qname)), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | my $instance_type_name = $opts{'instance_type_name'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 2 | ▶ | || sprintf('%sInstance', $builder->type_name($qname, $opts{'prefix'})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$opts{'instance_type_name'} || sprintf('%sInstance', $builder->type_name($qname, $opts{'prefix'}))
MC/DC0%0/2
$opts{'instance_type_name'} || sprintf('%sInstance', $builder->type_name($qname, $opts{'prefix'}))
$opts{'instance_type_name'}
sprintf('%sInstance', $builder->type_name($qname, $opts{'prefix'}))
Truth table33%1/3
A || B
A= $opts{'instance_type_name'}B= sprintf('%sInstance', $builder->type_name($qname, $opts{'prefix'}))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 2 | my $instance_type = $opts{'type_library'}->add_type({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | name => $instance_type_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | parent => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | constraint => sprintf('$_->can("GENERATOR") && ($_->GENERATOR eq %s)', B::perlstring($qname)), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 2 | ▶ | if ($opts{'factory_package'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 2 | my $reg = Type::Registry->for_class($opts{'factory_package'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 2 | $reg->add_type($_) for $class_type, $instance_type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 191 | ▶ | sub _make_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_make_type: called CC=11 SCAR=24.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 191 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 191 | my ($name, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 191 | my $qname = $builder->qualify_name($name, $opts{prefix}, $opts{extends}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 191 | ▶ | my $type_name = $opts{'type_name'} || $builder->type_name($qname, $opts{'prefix'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$opts{'type_name'} || $builder->type_name($qname, $opts{'prefix'})
MC/DC0%0/2
$opts{'type_name'} || $builder->type_name($qname, $opts{'prefix'})
$opts{'type_name'}
$builder->type_name($qname, $opts{'prefix'})
Truth table66%2/3
A || B
A= $opts{'type_name'}B= $builder->type_name($qname, $opts{'prefix'})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 191 | ▶ | if ($opts{'type_library'}->can('_mooxpress_add_type')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | $opts{'type_library'}->_mooxpress_add_type( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | $type_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | $opts{is_role} ? 'role' : 'class', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | $qname, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | !!$opts{coerce}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 191 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 191 | ▶ | if (defined $opts{'with'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 75 | my @tag_roles = grep /\?$/, $opts{'with'}->$_handle_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 75 | for my $role (@tag_roles) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 2 | $role =~ s/\?$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 2 | my %opts_clone = %opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 2 | delete $opts_clone{$_} for @delete_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 2 | $builder->make_type_for_role($role, %opts_clone); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 191 | ▶ | if (defined $opts{'subclass'} and not $opts{'is_role'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $opts{"subclass"} and not $opts{"is_role"}
MC/DC50%1/2
defined $opts{"subclass"} and not $opts{"is_role"}
defined $opts{"subclass"}
not $opts{"is_role"}
Truth table66%2/3
A and not(B)
A= defined $opts{"subclass"}B= not $opts{"is_role"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 15 | my @subclasses = $opts{'subclass'}->$_handle_list_add_nulls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 15 | ▶ | while (@subclasses) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 63 | my ($sc_name, $sc_opts) = splice @subclasses, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 63 | my %opts_clone = %opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 63 | delete $opts_clone{$_} for @delete_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 63 | $builder->make_type_for_class($sc_name, %opts_clone, extends => make_absolute_package_name($qname), $sc_opts->$_handle_list); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 57 | ▶ | sub do_coercions_for_role { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_coercions_for_role: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 57 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 57 | my ($name, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 57 | $builder->_do_coercions($name, %opts, is_role => 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 132 | ▶ | sub do_coercions_for_class { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_coercions_for_class: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 132 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 132 | my ($name, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 132 | $builder->_do_coercions($name, %opts, is_role => 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 189 | ▶ | sub _do_coercions { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_do_coercions: called CC=19 SCAR=30.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 189 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 189 | my ($name, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 189 | my $qname = $builder->qualify_name($name, $opts{prefix}, $opts{extends}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 189 | my $mytype; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 189 | ▶ | if ($opts{type_library}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 189 | ▶ | $mytype = $opts{type_library}->get_type_for_package($opts{'is_role'} ? 'role' : 'class', $qname); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 189 | ▶ | if ($opts{coerce}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 7 | ▶ | if ($opts{abstract}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | Carp::croak("abstract class $qname cannot have coercions") | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 7 | ▶ | my $method_installer = $opts{toolkit_install_methods} || ("install_methods"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opts{'toolkit_install_methods'} || 'install_methods'
MC/DC0%0/1
$opts{'toolkit_install_methods'} || 'install_methods'
$opts{'toolkit_install_methods'}
Truth table50%1/2
A
A= $opts{'toolkit_install_methods'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 7 | ▶ | my @coercions = @{$opts{'coerce'} || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opts{'coerce'} || []
MC/DC0%0/1
$opts{'coerce'} || []
$opts{'coerce'}
Truth table50%1/2
A
A= $opts{'coerce'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 7 | ▶ | while (@coercions) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 7 | my $type = shift @coercions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 7 | ▶ | if (!ref $type) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 3 | my $tc = $opts{reg}->lookup($type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 3 | ▶ | $type = $tc if $tc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 7 | my $method_name = shift @coercions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 7 | ▶ | defined($method_name) && !ref($method_name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $method_name and not ref $method_name
MC/DC0%0/2
defined $method_name and not ref $method_name
defined $method_name
not ref $method_name
Truth table33%1/3
A and not(B)
A= defined $method_nameB= not ref $method_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | or $builder->croak("No method name found for coercion to $qname from $type"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 7 | my $coderef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 7 | ▶ | $coderef = shift @coercions if is_CodeRef $coercions[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 7 | ▶ | if ($coderef) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | $builder->$method_installer( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | $qname, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 14 | ▶ | { $method_name => sub { local $_ = $_[1]; &$coderef } }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 7 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 7 | ▶ | if ($mytype) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 7 | require B; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 7 | $mytype->coercion->add_type_coercions($type, sprintf('%s->%s($_)', B::perlstring($qname), $method_name)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 189 | ▶ | if (defined $opts{'subclass'} and not $opts{'is_role'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $opts{"subclass"} and not $opts{"is_role"}
MC/DC50%1/2
defined $opts{"subclass"} and not $opts{"is_role"}
defined $opts{"subclass"}
not $opts{"is_role"}
Truth table66%2/3
A and not(B)
A= defined $opts{"subclass"}B= not $opts{"is_role"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 15 | my @subclasses = $opts{'subclass'}->$_handle_list_add_nulls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 15 | ▶ | while (@subclasses) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 63 | my ($sc_name, $sc_opts) = splice @subclasses, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 63 | my %opts_clone = %opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 63 | delete $opts_clone{$_} for @delete_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 63 | $builder->do_coercions_for_class($sc_name, %opts_clone, extends => make_absolute_package_name($qname), $sc_opts->$_handle_list); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 71 | ▶ | sub make_role { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_role: called CC=7 SCAR=30.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 71 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 71 | my ($name, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 71 | ▶ | if ($opts{interface}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | for my $key (qw/ can before after around has multimethod /) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | ▶ | if ($opts{$key}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | my $qname = $builder->qualify_name($name, $opts{prefix}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | Carp::croak("interface $qname cannot have $key"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 71 | for my $key (qw/ abstract extends subclass factory overload multifactory /) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 426 | ▶ | if ($opts{$key}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | my $qname = $builder->qualify_name($name, $opts{prefix}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | ▶ | my $kind = $opts{interface} ? 'interface' : 'role'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | Carp::croak("$kind $qname cannot have $key"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 71 | $builder->_make_package($name, %opts, is_role => 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 139 | ▶ | sub make_class { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_class: called CC=9 SCAR=32.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 139 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 139 | my ($name, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 139 | ▶ | if ($opts{abstract}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 1 | for my $key (qw/ factory /) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 1 | ▶ | if ($opts{$key}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | ▶ | my @isa = $opts{extends} ? $builder->_expand_isa($opts{prefix}, $opts{extends}) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | my $qname = $builder->qualify_name($name, $opts{prefix}, @isa); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 0 | Carp::croak("abstract class $qname cannot have $key"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 139 | for my $key (qw/ interface before_apply after_apply requires /) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 556 | ▶ | if ($opts{$key}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | ▶ | my @isa = $opts{extends} ? $builder->_expand_isa($opts{prefix}, $opts{extends}) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | my $qname = $builder->qualify_name($name, $opts{prefix}, @isa); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | ▶ | my $kind = $opts{abstract} ? 'abstract class' : 'class'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | Carp::croak("$kind $qname cannot have $key"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 139 | $builder->_make_package($name, %opts, is_role => 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 2 | ▶ | sub make_role_generator { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_role_generator: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 2 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 2 | my ($name, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 2 | $builder->_make_package_generator($name, %opts, is_role => 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 2 | ▶ | sub make_class_generator { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_class_generator: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 2 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 2 | my ($name, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 2 | $builder->_make_package_generator($name, %opts, is_role => 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 83 | ▶ | sub _expand_isa { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_expand_isa: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 83 | my ($builder, $pfx, $ext) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 83 | my @raw = $ext->$_handle_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 83 | my @isa; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | my $changed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 83 | ▶ | while (@raw) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 83 | ▶ | if (@raw > 1 and ref($raw[1])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@raw > 1 and ref $raw[1]
MC/DC50%1/2
@raw > 1 and ref $raw[1]
@raw > 1
ref $raw[1]
Truth table66%2/3
A and B
A= @raw > 1B= ref $raw[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 2 | my $gen = $builder->qualify_name(shift(@raw), $pfx); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 2 | my @args = shift(@raw)->$_handle_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 2 | push @isa, make_absolute_package_name($gen->generate_package(@args)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 2 | $changed++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 81 | push @isa, shift(@raw); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 83 | ▶ | @$ext = @isa if $changed;; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 83 | map $builder->qualify_name($_, $pfx), @isa; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 40 | my $nondeep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 210 | ▶ | sub _make_package { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_make_package: called CC=102 SCAR=50.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 210 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 210 | my ($name, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 210 | ▶ | my @isa = $opts{extends} ? $builder->_expand_isa($opts{prefix}, $opts{extends}) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 210 | my $qname = $builder->qualify_name($name, $opts{prefix}, @isa); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 210 | my $tn = $builder->type_name($qname, $opts{prefix}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 40 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 210 | ▶ | return if ${"$qname\::BUILT"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 203 | ▶ | $builder->_mark_package_as_loaded(($opts{is_role} ? 'role' : 'class') => $qname, \%opts); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 203 | ▶ | if (!exists $opts{factory} and !exists $opts{multifactory}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
exists $opts{"factory"} or exists $opts{"multifactory"}
MC/DC100%2/2
exists $opts{"factory"} or exists $opts{"multifactory"}
exists $opts{"factory"}
exists $opts{"multifactory"}
Truth table100%3/3
A or B
A= exists $opts{"factory"}B= exists $opts{"multifactory"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 185 | ▶ | $opts{factory} = $opts{abstract} ? undef : sprintf('new_%s', lc $tn); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | my $toolkit = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | moo => 'Moo', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | moose => 'Moose', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | mouse => 'Mouse', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 203 | ▶ | }->{lc $opts{toolkit}} || $opts{toolkit}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
{'moo', 'Moo', 'moose', 'Moose', 'mouse', 'Mouse'}->{lc $opts{'toolkit'}} || $opts{'toolkit'}
MC/DC0%0/2
{'moo', 'Moo', 'moose', 'Moose', 'mouse', 'Mouse'}->{lc $opts{'toolkit'}} || $opts{'toolkit'}
{'moo', 'Moo', 'moose', 'Moose', 'mouse', 'Mouse'}->{lc $opts{'toolkit'}}
$opts{'toolkit'}
Truth table33%1/3
A || B
A= {'moo', 'Moo', 'moose', 'Moose', 'mouse', 'Mouse'}->{lc $opts{'toolkit'}}B= $opts{'toolkit'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 203 | ▶ | if ($opts{is_role}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 65 | use_module("$toolkit\::Role")->import::into($qname); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 65 | use_module("namespace::autoclean")->import::into($qname); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 138 | use_module($toolkit)->import::into($qname); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 138 | ▶ | use_module("MooX::TypeTiny")->import::into($qname) if $toolkit eq 'Moo' && eval { require MooX::TypeTiny; 'MooX::TypeTiny'->VERSION('0.002001') }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$toolkit eq "Moo" and eval {
do {
require MooX::TypeTiny;
"MooX::TypeTiny"->VERSION("0.002001")
}
}
MC/DC50%1/2
$toolkit eq "Moo" and eval {
do {
require MooX::TypeTiny;
"MooX::TypeTiny"->VERSION("0.002001")
}
}
$toolkit eq "Moo"
eval {
do {
require MooX::TypeTiny;
"MooX::TypeTiny"->VERSION("0.002001")
}
}
Truth table66%2/3
A and B
A= $toolkit eq "Moo"B= eval {
do {
require MooX::TypeTiny;
"MooX::TypeTiny"->VERSION("0.002001")
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 138 | ▶ | use_module("MooseX::XSAccessor")->import::into($qname) if $toolkit eq 'Moose' && eval { require MooseX::XSAccessor }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$toolkit eq "Moose" and eval {
do {
require MooseX::XSAccessor
}
}
MC/DC0%0/2
$toolkit eq "Moose" and eval {
do {
require MooseX::XSAccessor
}
}
$toolkit eq "Moose"
eval {
do {
require MooseX::XSAccessor
}
}
Truth table66%2/3
A and B
A= $toolkit eq "Moose"B= eval {
do {
require MooseX::XSAccessor
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 138 | use_module("namespace::autoclean")->import::into($qname); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 138 | my $method = "extend_class_" . lc $toolkit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 138 | ▶ | if (@isa) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | # Check that each parent class exists | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 80 | PARENT: for my $parent_qname ( @isa ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 40 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 80 | ▶ | next if ${"$parent_qname\::BUILT"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | ▶ | next if eval { use_module($parent_qname); 1 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | # Parent class is not already built by MooX::Press. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | # Parent class is not loadable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | # This is going to be an issue when we try to extend it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 1 | ▶ | my @dfns = @{ $opts{_classes} || [] } or last PARENT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$opts{'_classes'} || []
MC/DC0%0/1
$opts{'_classes'} || []
$opts{'_classes'}
Truth table50%1/2
A
A= $opts{'_classes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 1 | DFN: for my $dfn ( @dfns ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 3 | my ( $dfn_shortname, $dfn_spec ) = @$dfn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 3 | my %dfn_spec = %opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 3 | delete $dfn_spec{$_} for @delete_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 3 | %dfn_spec = ( %dfn_spec, %$dfn_spec ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 3 | ▶ | my @dfn_isa = $dfn_spec{extends} ? $builder->_expand_isa($dfn_spec{prefix}, $dfn_spec{extends}) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 3 | my $dfn_qname = $builder->qualify_name($dfn_shortname, $dfn_spec{prefix}, @dfn_isa); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | # We have found a saviour! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 3 | ▶ | if ($parent_qname eq $dfn_qname) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 1 | $builder->make_class( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | make_absolute_package_name($parent_qname), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | %dfn_spec, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 1 | last DFN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 80 | $builder->$method($qname, \@isa); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 203 | my $reg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 203 | ▶ | if ($opts{factory_package}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 194 | require Type::Registry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 'Type::Registry'->for_class($qname)->set_parent( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 'Type::Registry'->for_class($opts{factory_package}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 194 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 194 | $reg = 'Type::Registry'->for_class($qname); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 40 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 203 | ${"$qname\::TOOLKIT"} = $toolkit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 203 | ${"$qname\::PREFIX"} = $opts{prefix}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 203 | ${"$qname\::FACTORY"} = $opts{factory_package}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 203 | ${"$qname\::TYPES"} = $opts{type_library}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 203 | ${"$qname\::BUILT"} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 1015 | &Internals::SvREADONLY(\${"$qname\::$_"}, 1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 203 | for qw/TOOLKIT PREFIX FACTORY TYPES BUILT/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 203 | for my $var (qw/VERSION AUTHORITY/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 406 | ▶ | if (defined $opts{lc $var}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 140 | ${"$qname\::$var"} = $opts{lc $var}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 140 | &Internals::SvREADONLY(\${"$qname\::$var"}, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 203 | ▶ | if ( $opts{factory_package} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 194 | ▶ | eval "sub $qname\::FACTORY { q[".$opts{factory_package}."] }; 1" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Pod
undocumented
Pod
undocumented
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | or $builder->croak("Couldn't create link back to factory $qname\::FACTORY: $@"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 203 | ▶ | if (defined $opts{'import'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 51 | my @imports = $opts{'import'}->$_handle_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 51 | ▶ | while (@imports) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | my $import = shift @imports; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | my @params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | ▶ | if (is_HashRef($imports[0])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | @params = %{ shift @imports }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | elsif (is_ArrayRef($imports[0])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | @params = @{ shift @imports }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | use_module($import)->import::into($qname, @params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 203 | ▶ | if (my $hook = $opts{'begin'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | my @coderefs = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 1 | ▶ | is_HashRef($_) ? $builder->wrap_coderef(package => $qname, %$_) : $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | } is_ArrayRef($hook) ? @$hook : $hook; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 1 | for my $cb (@coderefs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 1 | ▶ | $cb->($qname, $opts{is_role} ? 'role' : 'class'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 203 | ▶ | if ($opts{overload}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 1 | my @overloads = $opts{overload}->$_handle_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 1 | require overload; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 1 | require Import::Into; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 1 | 'overload'->import::into($qname, @overloads); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 203 | ▶ | if (defined $opts{can}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 30 | my %methods = $opts{can}->$_handle_list_add_nulls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 30 | ▶ | $builder->install_methods($qname, \%methods) if keys %methods; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 203 | ▶ | if (defined $opts{factory_package_can} and defined $opts{factory_package}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $opts{"factory_package_can"} and defined $opts{"factory_package"}
MC/DC0%0/2
defined $opts{"factory_package_can"} and defined $opts{"factory_package"}
defined $opts{"factory_package_can"}
defined $opts{"factory_package"}
Truth table33%1/3
A and B
A= defined $opts{"factory_package_can"}B= defined $opts{"factory_package"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | my %methods = $opts{factory_package_can}->$_handle_list_add_nulls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | ▶ | $builder->install_methods($opts{factory_package}, \%methods) if keys %methods; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 203 | ▶ | if (defined $opts{type_library_can} and defined $opts{type_library}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $opts{"type_library_can"} and defined $opts{"type_library"}
MC/DC0%0/2
defined $opts{"type_library_can"} and defined $opts{"type_library"}
defined $opts{"type_library_can"}
defined $opts{"type_library"}
Truth table33%1/3
A and B
A= defined $opts{"type_library_can"}B= defined $opts{"type_library"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | my %methods = $opts{type_library_can}->$_handle_list_add_nulls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | ▶ | $builder->install_methods($opts{type_library}, \%methods) if keys %methods; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 203 | ▶ | if (defined $opts{constant}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 5 | my %constants = $opts{constant}->$_handle_list_add_nulls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 5 | ▶ | $builder->install_constants($qname, \%constants) if keys %constants; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 203 | ▶ | if (defined $opts{has}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 35 | $builder->install_attributes($qname, $opts{has}, \%opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 202 | ▶ | if (defined $opts{symmethod}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 10 | $builder->install_symmethods($qname, $opts{symmethod}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 202 | ▶ | if (defined $opts{multimethod}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 4 | my @mm = $opts{multimethod}->$_handle_list_add_nulls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 4 | ▶ | while (@mm) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 4 | my ($method_name, $method_spec) = splice(@mm, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 4 | ▶ | $builder->install_multimethod($qname, $opts{is_role}?'role':'class', $method_name, $method_spec); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 202 | ▶ | if (defined $opts{with}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 75 | my @roles = $opts{with}->$_handle_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 75 | ▶ | if (@roles) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 75 | my @processed; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 75 | ▶ | while (@roles) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 102 | ▶ | if (@roles > 1 and ref($roles[1])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@roles > 1 and ref $roles[1]
MC/DC100%2/2
@roles > 1 and ref $roles[1]
@roles > 1
ref $roles[1]
Truth table100%3/3
A and B
A= @roles > 1B= ref $roles[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 1 | my $gen = $builder->qualify_name(shift(@roles), $opts{prefix}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 1 | my @args = shift(@roles)->$_handle_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 1 | push @processed, $gen->generate_package(@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 101 | my $role_qname = $builder->qualify_name(shift(@roles), $opts{prefix}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 101 | push @processed, $role_qname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 40 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 101 | ▶ | if ( $role_qname !~ /\?$/ and not ${"$role_qname\::BUILT"} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$role_qname =~ /\?$/ or ${"${role_qname}::BUILT";}
MC/DC100%2/2
$role_qname =~ /\?$/ or ${"${role_qname}::BUILT";}
$role_qname =~ /\?$/
${"${role_qname}::BUILT";}
Truth table100%3/3
A or B
A= $role_qname =~ /\?$/B= ${"${role_qname}::BUILT";}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 6 | my ($role_dfn) = grep { $_->[0] eq make_absolute_package_name($role_qname) } @{$opts{_roles}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | $builder->make_role( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | make_absolute_package_name($role_qname), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | _parent_opts => $opts{_parent_opts}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | _roles => $opts{_roles}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 6 | %{ $opts{_parent_opts} }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 6 | ▶ | %{ $role_dfn->[1] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | ) if $role_dfn; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 75 | my $installer = "apply_roles_" . lc $toolkit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 75 | ▶ | $builder->$installer($qname, $opts{is_role}?'role':'class', \@processed); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 202 | ▶ | if ($opts{is_role} and defined $opts{requires}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$opts{"is_role"} and defined $opts{"requires"}
MC/DC100%2/2
$opts{"is_role"} and defined $opts{"requires"}
$opts{"is_role"}
defined $opts{"requires"}
Truth table100%3/3
A and B
A= $opts{"is_role"}B= defined $opts{"requires"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 1 | my $installer = "require_methods_" . lc $toolkit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 1 | my %requires = $opts{requires}->$_handle_list_add_nulls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 1 | ▶ | $builder->$installer($qname, \%requires) if keys %requires; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 202 | ▶ | if (defined $opts{'factory_package'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 193 | my $fpackage = $opts{'factory_package'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 193 | ▶ | if ($opts{'factory'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 180 | ▶ | if ($opts{abstract} and $opts{'factory'}->$_handle_list) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$opts{"abstract"} and $opts{"factory"}->$_handle_list
MC/DC0%0/2
$opts{"abstract"} and $opts{"factory"}->$_handle_list
$opts{"abstract"}
$opts{"factory"}->$_handle_list
Truth table33%1/3
A and B
A= $opts{"abstract"}B= $opts{"factory"}->$_handle_list
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | Carp::croak("abstract class $qname cannot have factory"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 180 | $builder->install_factories($fpackage, $qname, $opts{'factory'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 193 | ▶ | if ($opts{multifactory}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 4 | my @mm = $opts{multifactory}->$_handle_list_add_nulls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 4 | ▶ | while (@mm) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 4 | my ($method_name, $method_spec) = splice(@mm, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 4 | ▶ | my $old_coderef = $method_spec->{code} or die; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 4 | ▶ | my $new_coderef = sub { splice(@_, 1, 0, "$qname"); goto $old_coderef }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 4 | $builder->install_multimethod($fpackage, 'class', $method_name, { %$method_spec, code => $new_coderef }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 202 | for my $modifier (qw(before after around)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 606 | ▶ | if (defined $opts{$modifier}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 20 | my @methods = $opts{$modifier}->$_handle_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 20 | my $installer = "modify_method_" . lc $toolkit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 20 | ▶ | while (@methods) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 20 | my @method_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 20 | ▶ | push(@method_names, shift @methods) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@methods and not ref $methods[0]
MC/DC50%1/2
@methods and not ref $methods[0]
@methods
not ref $methods[0]
Truth table66%2/3
A and not(B)
A= @methodsB= not ref $methods[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | while (@methods and not ref $methods[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 20 | my $coderef = $builder->_prepare_method_modifier($qname, $modifier, \@method_names, shift(@methods)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 20 | $builder->$installer($qname, $modifier, \@method_names, $coderef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 202 | ▶ | if ($opts{is_role}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 65 | for my $event (qw/ before_apply after_apply /) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 130 | ▶ | if (my $hook = $opts{$event}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 9 | require Role::Hooks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | my @coderefs = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 9 | ▶ | is_HashRef($_) ? $builder->wrap_coderef(package => $qname, %$_) : $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | } is_ArrayRef($hook) ? @$hook : $hook; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 9 | 'Role::Hooks'->$event($qname, @coderefs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | # not role | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 137 | ▶ | if ($toolkit eq 'Moose' && !$opts{'mutable'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$toolkit eq "Moose" and not $opts{"mutable"}
MC/DC50%1/2
$toolkit eq "Moose" and not $opts{"mutable"}
$toolkit eq "Moose"
not $opts{"mutable"}
Truth table66%2/3
A and not(B)
A= $toolkit eq "Moose"B= not $opts{"mutable"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 26 | require Moose::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 26 | ▶ | my %args = %{ $opts{'definition_context'} or {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$opts{'definition_context'} || {}
MC/DC100%1/1
$opts{'definition_context'} || {}
$opts{'definition_context'}
Truth table100%2/2
A
A= $opts{'definition_context'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 26 | delete $args{'package'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 26 | Moose::Util::find_meta($qname)->make_immutable(%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 137 | ▶ | if ($toolkit eq 'Moo' && eval { require MooX::XSConstructor }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$toolkit eq "Moo" and eval {
do {
require MooX::XSConstructor
}
}
MC/DC0%0/2
$toolkit eq "Moo" and eval {
do {
require MooX::XSConstructor
}
}
$toolkit eq "Moo"
eval {
do {
require MooX::XSConstructor
}
}
Truth table66%2/3
A and B
A= $toolkit eq "Moo"B= eval {
do {
require MooX::XSConstructor
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 0 | 'MooX::XSConstructor'->setup_for($qname); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 137 | ▶ | if ($opts{abstract}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | 1 | my $orig_can = $qname->can('can'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 0 | ▶ | my $orig_BUILD = do { no strict 'refs'; exists(&{"$qname\::BUILD"}) ? \&{"$qname\::BUILD"} : sub {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
__ANON__: called CC=1 SCAR=0.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 1 | 'namespace::clean'->clean_subroutines($qname, 'new', 'BUILD'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | $builder->install_methods($qname, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | 8 | ▶ | can => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 8 | ▶ | if ((ref($_[0])||$_[0]) eq $qname and $_[1] eq 'new') { return; }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
(ref $_[0] || $_[0]) eq $qname and $_[1] eq "new"
ref $_[0] || $_[0]
MC/DC33%1/3
(ref $_[0] || $_[0]) eq $qname and $_[1] eq "new"
ref $_[0]
$_[0]
$_[1] eq "new"
Truth table40%2/5
A || B and C
A= ref $_[0]B= $_[0]C= $_[1] eq "new"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 10 | goto $orig_can; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 3 | ▶ | BUILD => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 2 | ▶ | if (ref($_[0]) eq $qname) { require Carp; Carp::croak('abstract class'); }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 1 | goto $orig_BUILD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 1 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 137 | ▶ | if (defined $opts{'subclass'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 15 | my @subclasses = $opts{'subclass'}->$_handle_list_add_nulls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 15 | ▶ | while (@subclasses) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 63 | my ($sc_name, $sc_opts) = splice @subclasses, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 63 | my %opts_clone = %opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 63 | delete $opts_clone{$_} for @delete_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 63 | $builder->make_class($sc_name, %opts_clone, extends => make_absolute_package_name($qname), $sc_opts->$_handle_list); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 202 | ▶ | if (my $hook = $opts{'end'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | my @coderefs = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 0 | ▶ | is_HashRef($_) ? $builder->wrap_coderef(package => $qname, %$_) : $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | } is_ArrayRef($hook) ? @$hook : $hook; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 0 | for my $cb (@coderefs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 0 | ▶ | $cb->($qname, $opts{is_role} ? 'role' : 'class'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 202 | ▶ | if ($opts{type_library} and $opts{type_name}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$opts{"type_library"} and $opts{"type_name"}
MC/DC100%2/2
$opts{"type_library"} and $opts{"type_name"}
$opts{"type_library"}
$opts{"type_name"}
Truth table100%3/3
A and B
A= $opts{"type_library"}B= $opts{"type_name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 8 | ▶ | my $mytype = $opts{type_library}->get_type_for_package($opts{'is_role'} ? 'role' : 'class', $qname); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 8 | ▶ | $mytype->coercion->freeze if $mytype; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 202 | return $qname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 11 | ▶ | sub patch_package { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
patch_package: called CC=44 SCAR=46.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 8 | my ( $me, $package, %spec ) = ( shift, @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 8 | ▶ | my $kind = ( $spec{is_role} or do { require Role::Hooks; 'Role::Hooks'->is_role($package) } ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$spec{"is_role"} or do {
require Role::Hooks;
"Role::Hooks"->is_role($package)
}
MC/DC50%1/2
$spec{"is_role"} or do {
require Role::Hooks;
"Role::Hooks"->is_role($package)
}
$spec{"is_role"}
do {
require Role::Hooks;
"Role::Hooks"->is_role($package)
}
Truth table66%2/3
A or B
A= $spec{"is_role"}B= do {
require Role::Hooks;
"Role::Hooks"->is_role($package)
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | ? 'role' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | : 'class'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 8 | delete $spec{is_role}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | my $fp = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | exists($spec{'factory_package'}) ? delete($spec{'factory_package'}) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | $package->can('FACTORY') ? $package->FACTORY : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 40 | ▶ | do { no strict 'refs'; no warnings; ${"$package\::FACTORY"} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | my $prefix = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | exists($spec{'prefix'}) ? delete($spec{'prefix'}) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 40 | ▶ | do { no strict 'refs'; no warnings; ${"$package\::PREFIX"} || $fp }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
Condition66%2/3
${"${package}::PREFIX";} || $fp
MC/DC50%1/2
${"${package}::PREFIX";} || $fp
${"${package}::PREFIX";}
$fp
Truth table66%2/3
A || B
A= ${"${package}::PREFIX";}B= $fp
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | my $toolkit = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | exists($spec{'toolkit'}) ? delete($spec{'toolkit'}) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 40 | ▶ | do { no strict 'refs'; no warnings; ${"$package\::TOOLKIT"} || 'Moo' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
Condition100%2/2
${"${package}::TOOLKIT";} || 'Moo'
MC/DC100%1/1
${"${package}::TOOLKIT";} || 'Moo'
${"${package}::TOOLKIT";}
Truth table100%2/2
A
A= ${"${package}::TOOLKIT";}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 8 | ▶ | if ( my $version = delete $spec{version} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 0 | ${"$package\::VERSION"} = $version; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 8 | ▶ | if ( my $auth = delete $spec{authority} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 0 | ${"$package\::AUTHORITY"} = $auth; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 8 | ▶ | if ( $kind eq 'class' and my $extends = delete $spec{extends} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$kind eq "class" and my $extends = delete $spec{"extends"}
MC/DC100%2/2
$kind eq "class" and my $extends = delete $spec{"extends"}
$kind eq "class"
my $extends = delete $spec{"extends"}
Truth table100%3/3
A and B
A= $kind eq "class"B= my $extends = delete $spec{"extends"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 1 | my @isa = $me->_expand_isa( $prefix, $extends ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 1 | ▶ | if ( $package->isa("$toolkit\::Object") ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 1 | my $method = "extend_class_" . lc $toolkit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 1 | $me->$method( $package, \@isa ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 40 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 0 | @{"$package\::ISA"} = @isa; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 8 | ▶ | if ( $kind eq 'class' and my $overload = delete $spec{overload} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$kind eq "class" and my $overload = delete $spec{"overload"}
MC/DC0%0/2
$kind eq "class" and my $overload = delete $spec{"overload"}
$kind eq "class"
my $overload = delete $spec{"overload"}
Truth table66%2/3
A and B
A= $kind eq "class"B= my $overload = delete $spec{"overload"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 0 | require overload; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 0 | require Import::Into; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 0 | 'overload'->import::into( $package, $overload->$_handle_list ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 8 | ▶ | if ( my @coercions = @ { delete $spec{coerce} or [] } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
delete $spec{'coerce'} || []
MC/DC0%0/1
delete $spec{'coerce'} || []
delete $spec{'coerce'}
Truth table50%1/2
A
A= delete $spec{'coerce'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 0 | my $to_type = $fp->type_library->get_type_for_package( any => $package ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | 0 | ▶ | while ( @coercions ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 0 | my $from_type = 'Type::Registry'->for_class( $package )->lookup( shift @coercions ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | my $via_method = shift @coercions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 0 | ▶ | if ( is_CodeRef $coercions[0] or is_HashRef $coercions[0] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
is_CodeRef($coercions[0]) or is_HashRef($coercions[0])
MC/DC0%0/2
is_CodeRef($coercions[0]) or is_HashRef($coercions[0])
is_CodeRef($coercions[0])
is_HashRef($coercions[0])
Truth table0%0/3
A or B
A= is_CodeRef($coercions[0])B= is_HashRef($coercions[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 0 | my $coderef = shift @coercions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 0 | ▶ | 'MooX::Press'->install_methods( $package, { $via_method => sub { local $_ = $_[1]; &$coderef } } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | $to_type->coercion->add_type_coercions( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | 0 | $from_type, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | sprintf( '%s->%s($_)', B::perlstring($package), $via_method ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 8 | ▶ | if ( my $methods = delete $spec{can} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 4 | $me->install_methods( $package, $methods ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 8 | ▶ | if ( my $constants = delete $spec{constant} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 1 | $me->install_constants( $package, $constants ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 8 | ▶ | if ( my $atts = delete $spec{has} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 1 | $me->install_attributes( $package, $atts ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 8 | ▶ | if ( my $symm = delete $spec{symmethod} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 0 | $me->install_symmethods($package, $symm); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 8 | ▶ | if ( my $multimethods = delete $spec{multimethod} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 1 | my @mm = $multimethods->$_handle_list_add_nulls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 1 | ▶ | while ( my ( $name, $code ) = splice( @mm, 0, 2 ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 2 | 'MooX::Press'->install_multimethod( $package, $kind, $name, $code ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | 8 | ▶ | if (defined $spec{with}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 2 | my @roles = $spec{with}->$_handle_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 2 | ▶ | if (@roles) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 2 | my @processed; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 2 | ▶ | while (@roles) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 2 | ▶ | if (@roles > 1 and ref($roles[1])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@roles > 1 and ref $roles[1]
MC/DC0%0/2
@roles > 1 and ref $roles[1]
@roles > 1
ref $roles[1]
Truth table33%1/3
A and B
A= @roles > 1B= ref $roles[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 0 | my $gen = $me->qualify_name(shift(@roles), $prefix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 0 | my @args = shift(@roles)->$_handle_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | 0 | push @processed, $gen->generate_package(@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 2 | my $role_qname = $me->qualify_name(shift(@roles), $prefix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 2 | push @processed, $role_qname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 2 | my $installer = "apply_roles_" . lc $toolkit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 2 | $me->$installer($package, $kind, \@processed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 8 | ▶ | if ( $kind eq 'class' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | 7 | ▶ | if ( $fp and my $factory = delete $spec{factory} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$fp and my $factory = delete $spec{"factory"}
MC/DC0%0/2
$fp and my $factory = delete $spec{"factory"}
$fp
my $factory = delete $spec{"factory"}
Truth table66%2/3
A and B
A= $fpB= my $factory = delete $spec{"factory"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | 0 | $me->install_factories( $fp, $package, $factory ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 7 | ▶ | if ( $fp and my $factory = delete $spec{multifactory} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$fp and my $factory = delete $spec{"multifactory"}
MC/DC0%0/2
$fp and my $factory = delete $spec{"multifactory"}
$fp
my $factory = delete $spec{"multifactory"}
Truth table66%2/3
A and B
A= $fpB= my $factory = delete $spec{"multifactory"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | 0 | my @mm = $factory->$_handle_list_add_nulls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 0 | ▶ | while (@mm) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 0 | my ($method_name, $method_spec) = splice(@mm, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 0 | ▶ | my $old_coderef = $method_spec->{code} or die; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 0 | ▶ | my $new_coderef = sub { splice(@_, 1, 0, "$package"); goto $old_coderef }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 0 | $me->install_multimethod( $fp , 'class', $method_name, { %$method_spec, code => $new_coderef }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | #TODO: subclass??? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 8 | for my $modifier ( qw/ before after around / ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | 24 | ▶ | my @mm = delete($spec{$modifier})->$_handle_list or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 4 | require Class::Method::Modifiers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | 4 | my @names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 4 | ▶ | while ( @mm ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 8 | ▶ | if ( is_ArrayRef $mm[0] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 0 | push @names, @{ shift @mm }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | elsif ( is_Str $mm[0] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | 4 | push @names, shift @mm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 4 | my $coderef = $me->_prepare_method_modifier( $package, $modifier, [@names], shift(@mm) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 4 | Class::Method::Modifiers::install_modifier( $package, $modifier, @names, $coderef ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 4 | @names = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 8 | return %spec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 201 | ▶ | sub install_factories { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_factories: called CC=21 SCAR=39.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 180 | my ($builder, $fpackage, $qname, $factories) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 180 | my $to_type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 180 | my @methods = $factories->$_handle_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | 180 | ▶ | while (@methods) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | 189 | my @method_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | 189 | ▶ | push(@method_names, shift @methods) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@methods and not ref $methods[0]
MC/DC100%2/2
@methods and not ref $methods[0]
@methods
not ref $methods[0]
Truth table100%3/3
A and not(B)
A= @methodsB= not ref $methods[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | while (@methods and not ref $methods[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | 189 | ▶ | my $coderef = shift(@methods) || \1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift @methods || \1
MC/DC100%1/1
shift @methods || \1
shift @methods
Truth table100%2/2
A
A= shift @methods
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | 189 | NAME: for my $name (@method_names) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 40 | ▶ | no warnings 'closure'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 205 | ▶ | if (is_CodeRef $coderef) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | 3 | ▶ | eval "package $fpackage; sub $name :method { splice(\@_, 1, 0, '$qname'); goto \$coderef }; 1" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | or $builder->croak("Could not create factory $name in $fpackage: $@"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | elsif (is_ScalarRef $coderef) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | 192 | my $target = $$coderef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | 192 | ▶ | if ($target eq 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | # default factory shouldn't overwrite manually created one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | 177 | ▶ | next NAME if $fpackage->can($name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | 177 | $target = 'new'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | 192 | ▶ | eval "package $fpackage; sub $name :method { shift; '$qname'->$target\(\@_) }; 1" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | or $builder->croak("Couldn't create factory $name in $fpackage: $@"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | elsif (is_HashRef $coderef) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | 10 | my %meta = %$coderef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | 10 | ▶ | $meta{curry} ||= [$qname]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$meta{"curry"} ||= [$qname]
MC/DC0%0/1
$meta{"curry"} ||= [$qname]
$meta{"curry"}
Truth table50%1/2
A
A= $meta{"curry"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 10 | ▶ | if ( match('coercion', $meta{attributes}) or match('coerce', $meta{attributes}) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
match("coercion", $meta{"attributes"}) or match("coerce", $meta{"attributes"})
MC/DC0%0/2
match("coercion", $meta{"attributes"}) or match("coerce", $meta{"attributes"})
match("coercion", $meta{"attributes"})
match("coerce", $meta{"attributes"})
Truth table33%1/3
A or B
A= match("coercion", $meta{"attributes"})B= match("coerce", $meta{"attributes"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | 0 | my @sigtypes = grep !is_HashRef($_), @{$meta{signature}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | 0 | ▶ | $to_type ||= $fpackage->type_library->get_type_for_package( any => $qname ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$to_type ||= $fpackage->type_library->get_type_for_package("any", $qname)
MC/DC0%0/2
$to_type ||= $fpackage->type_library->get_type_for_package("any", $qname)
$to_type
$fpackage->type_library->get_type_for_package("any", $qname)
Truth table0%0/3
A ||= B
A= $to_typeB= $fpackage->type_library->get_type_for_package("any", $qname)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | $builder->croak('Factories used as coercions must take exactly one positional argument') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | 0 | ▶ | unless is_ArrayRef( $meta{signature} ) && 1==@sigtypes && !$meta{named}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
is_ArrayRef($meta{"signature"}) and 1 == @sigtypes and not $meta{"named"}
is_ArrayRef($meta{"signature"}) and 1 == @sigtypes
MC/DC0%0/3
is_ArrayRef($meta{"signature"}) and 1 == @sigtypes and not $meta{"named"}
is_ArrayRef($meta{"signature"})
1 == @sigtypes
not $meta{"named"}
Truth table0%0/4
A and B and not(C)
A= is_ArrayRef($meta{"signature"})B= 1 == @sigtypesC= not $meta{"named"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | 0 | ▶ | $builder->croak("Too late to add coercion to $to_type") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | if $to_type->coercion->frozen; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | 0 | my $from_type = 'Type::Registry'->for_class($qname)->lookup( $sigtypes[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | 0 | $to_type->coercion->add_type_coercions( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | $from_type, sprintf('%s->%s($_)', B::perlstring($fpackage), $name), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | 0 | my @new_attrs = grep !/^coerc/, @{$meta{attributes}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 0 | $meta{attributes} = \@new_attrs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | 10 | $builder->install_methods($fpackage, { $name => \%meta }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | 0 | die "lolwut?"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | 189 | $builder->_make_exportable_factories($fpackage, @method_names); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | 189 | ▶ | sub _make_exportable_factories { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_make_exportable_factories: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | 189 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | 189 | my ($factory, @methods) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | 196 | foreach my $method ( @methods ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | 212 | ▶ | eval qq{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | package ${factory}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | sub _generate_${method} :method { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | sub { q[${factory}]->${method}( \@_ ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | } or die "Yikes: $@"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | 196 | push @{ $factory . '::EXPORT_OK' }, @methods; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | 196 | ▶ | push @{ ${ $factory . '::EXPORT_TAGS' }{'factories'} ||= [] }, @methods; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
do {
$factory . '::EXPORT_TAGS'
}->{"factories"} ||= []
MC/DC100%1/1
do {
$factory . '::EXPORT_TAGS'
}->{"factories"} ||= []
do {
$factory . '::EXPORT_TAGS'
}->{"factories"}
Truth table100%2/2
A
A= do {
$factory . '::EXPORT_TAGS'
}->{"factories"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | 11 | ▶ | sub _make_package_generator { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_make_package_generator: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 11 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | 11 | my ($name, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 11 | ▶ | my $gen = $opts{generator} or die 'no generator code given!'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | 11 | ▶ | my $kind = $opts{is_role} ? 'role' : 'class'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | 11 | my $qname = $builder->qualify_name($name, $opts{prefix}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | 4 | $builder->_mark_package_as_loaded("$kind generator" => $qname, \%opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | $builder->install_methods( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | $qname, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | '_generate_package_spec' => $gen, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | 13 | ▶ | 'generate_package' => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | 13 | my ($generator_package, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | 13 | $builder->generate_package( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | $kind, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | $generator_package, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | \%opts, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | $generator_package->_generate_package_spec(@args), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | 4 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | 4 | ▶ | if ($opts{factory_package}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | 4 | require Type::Registry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | 'Type::Registry'->for_class($qname)->set_parent( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | 'Type::Registry'->for_class($opts{factory_package}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | 4 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | 4 | my $tn = $builder->type_name($qname, $opts{prefix}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | 6 | ▶ | if (!exists $opts{factory}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | 6 | $opts{factory} = 'generate_' . lc $tn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | 11 | my $fp = $opts{factory_package}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | 11 | my $f = $opts{factory}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | 4 | eval qq{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | package $fp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | sub $f :method { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | q($qname)->generate_package(\@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | 4 | return $qname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | 40 | my %_generate_counter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | 15 | ▶ | sub generate_package { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate_package: called CC=10 SCAR=23.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | 8 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | 8 | my $kind = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | 6 | my $generator_package = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | 6 | my $global_opts = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | 12 | ▶ | my %local_opts = ( @_ == 1 ? $_[0] : \@_ )->$_handle_list; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | 12 | ▶ | $generator_package =~ s/^(main)?::// while $generator_package =~ /^(main)?::/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | 12 | my %opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | 12 | for my $key (qw/ extends with has can constant around before after | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | toolkit version authority mutable begin end requires import overload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | before_apply after_apply symmethod multimethod definition_context /) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | 138 | ▶ | if (exists $local_opts{$key}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | 16 | $opts{$key} = delete $local_opts{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | 12 | ▶ | if (keys %local_opts) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | 6 | die "bad keys from generator: ".join(", ", sort keys %local_opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | # must not generate types or factory methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | 6 | $opts{factory} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | 6 | $opts{multifactory} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | 6 | $opts{type_name} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | 6 | ▶ | $_generate_counter{$generator_package} = 0 unless exists $_generate_counter{$generator_package}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | 6 | my $qname = sprintf('%s::__GEN%06d__', $generator_package, ++$_generate_counter{$generator_package}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | 6 | require Type::Registry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | 6 | 'Type::Registry'->for_class($qname)->set_parent( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | 'Type::Registry'->for_class($generator_package) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | 6 | ▶ | if ($kind eq 'class') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | 4 | ▶ | my $method = $opts{toolkit_install_constants} || ("install_constants"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opts{'toolkit_install_constants'} || 'install_constants'
MC/DC0%0/1
$opts{'toolkit_install_constants'} || 'install_constants'
$opts{'toolkit_install_constants'}
Truth table50%1/2
A
A= $opts{'toolkit_install_constants'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | 4 | $builder->$method($qname, { GENERATOR => $generator_package }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | 6 | ▶ | if ($kind eq 'role') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | 2 | return $builder->make_role(make_absolute_package_name($qname), %$global_opts, %opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | 4 | return $builder->make_class(make_absolute_package_name($qname), %$global_opts, %opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | 138 | ▶ | sub _get_moo_helper { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_moo_helper: called CC=11 SCAR=24.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | 131 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | 131 | my ($package, $helpername) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | return $_cached_moo_helper{"$package\::$helpername"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | 131 | ▶ | if $_cached_moo_helper{"$package\::$helpername"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | 122 | ▶ | die "lolwut?" unless $helpername =~ /^(has|with|extends|around|before|after|requires)$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | 122 | ▶ | my $is_role = ($INC{'Moo/Role.pm'} && 'Moo::Role'->is_role($package)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$INC{'Moo/Role.pm'} && 'Moo::Role'->is_role($package)
MC/DC50%1/2
$INC{'Moo/Role.pm'} && 'Moo::Role'->is_role($package)
$INC{'Moo/Role.pm'}
'Moo::Role'->is_role($package)
Truth table66%2/3
A && B
A= $INC{'Moo/Role.pm'}B= 'Moo::Role'->is_role($package)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | 122 | ▶ | my $tracker = $is_role ? $Moo::Role::INFO{$package}{exports} : $Moo::MAKERS{$package}{exports}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | 122 | ▶ | if (ref $tracker) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | 0 | ▶ | $_cached_moo_helper{"$package\::$helpername"} ||= $tracker->{$helpername}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$_cached_moo_helper{"${package}::$helpername"} ||= $tracker->{$helpername}
MC/DC0%0/2
$_cached_moo_helper{"${package}::$helpername"} ||= $tracker->{$helpername}
$_cached_moo_helper{"${package}::$helpername"}
$tracker->{$helpername}
Truth table0%0/3
A ||= B
A= $_cached_moo_helper{"${package}::$helpername"}B= $tracker->{$helpername}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | # I hate this... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | 122 | ▶ | $_cached_moo_helper{"$package\::$helpername"} ||= eval sprintf( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 2 branches
Condition33%1/3
$_cached_moo_helper{"${package}::$helpername"} ||= eval sprintf("do { package %s; use Moo%s; my \$coderef = \\&%s; no Moo%s; \$coderef };", $package, $is_role ? "::Role" : "", $helpername, $is_role ? "::Role" : "")
MC/DC0%0/2
$_cached_moo_helper{"${package}::$helpername"} ||= eval sprintf("do { package %s; use Moo%s; my \$coderef = \\&%s; no Moo%s; \$coderef };", $package, $is_role ? "::Role" : "", $helpername, $is_role ? "::Role" : "")
$_cached_moo_helper{"${package}::$helpername"}
eval sprintf("do { package %s; use Moo%s; my \$coderef = \\&%s; no Moo%s; \$coderef };", $package, $is_role ? "::Role" : "", $helpername, $is_role ? "::Role" : "")
Truth table33%1/3
A ||= B
A= $_cached_moo_helper{"${package}::$helpername"}B= eval sprintf("do { package %s; use Moo%s; my \$coderef = \\&%s; no Moo%s; \$coderef };", $package, $is_role ? "::Role" : "", $helpername, $is_role ? "::Role" : "")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | 'do { package %s; use Moo%s; my $coderef = \&%s; no Moo%s; $coderef };', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | $package, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | $is_role ? '::Role' : '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | $helpername, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | $is_role ? '::Role' : '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | 122 | ▶ | die "BADNESS: couldn't get helper '$helpername' for package '$package'" unless $_cached_moo_helper{"$package\::$helpername"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | 122 | $_cached_moo_helper{"$package\::$helpername"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | 8 | ▶ | sub _detect_toolkit { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_detect_toolkit: called CC=9 SCAR=36.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | 1 | my ($builder, $qname) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | 1 | ▶ | return ${"$qname\::TOOLKIT"} if ${"$qname\::TOOLKIT"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | 0 | for my $tk (qw/ Moo Moose Mouse /) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | 0 | ▶ | return $tk if $qname->isa("$tk\::Object"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | 0 | require Role::Hooks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | 0 | ▶ | if (my $detected = 'Role::Hooks'->is_role($qname)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | 0 | ▶ | return 'Moo' if $detected eq 'Role::Tiny'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | 0 | ▶ | return 'Moo' if $detected eq 'Moo::Role'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | 0 | ▶ | return 'Moose' if $detected eq 'Moose::Role'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | 0 | ▶ | return 'Mouse' if $detected eq 'Mouse::Role'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | 0 | 'Moo'; # guess | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | 11 | ▶ | sub _detect_prefix { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_detect_prefix: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | 4 | my ($builder, $qname) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | 4 | ▶ | return ${"$qname\::PREFIX"} if ${"$qname\::PREFIX"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | 3 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | 1 | ▶ | sub _detect_type_library { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_detect_type_library: called CC=6 SCAR=26.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | 1 | my ($builder, $qname) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | 1 | ▶ | return ${"$qname\::TYPES"} if ${"$qname\::TYPES"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | 0 | my $factory = $qname->can('FACTORY'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | 0 | ▶ | $factory ||= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$factory ||= do {
no strict 'refs';
${"${qname}::FACTORY";} or ${"${qname}::FACTORY";}
}
MC/DC0%0/2
$factory ||= do {
no strict 'refs';
${"${qname}::FACTORY";} or ${"${qname}::FACTORY";}
}
$factory
do {
no strict 'refs';
${"${qname}::FACTORY";} or ${"${qname}::FACTORY";}
}
Truth table0%0/3
A ||= B
A= $factoryB= do {
no strict 'refs';
${"${qname}::FACTORY";} or ${"${qname}::FACTORY";}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | 0 | ▶ | ${"$qname\::FACTORY"} || ${"$qname\::FACTORY"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
${"${qname}::FACTORY";} || ${"${qname}::FACTORY";}
MC/DC0%0/2
${"${qname}::FACTORY";} || ${"${qname}::FACTORY";}
${"${qname}::FACTORY";}
${"${qname}::FACTORY";}
Truth table0%0/3
A || B
A= ${"${qname}::FACTORY";}B= ${"${qname}::FACTORY";}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | 0 | ▶ | return $factory->type_library | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$factory and $factory->can("type_library")
MC/DC0%0/2
$factory and $factory->can("type_library")
$factory
$factory->can("type_library")
Truth table0%0/3
A and B
A= $factoryB= $factory->can("type_library")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | if $factory && $factory->can('type_library'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | 36 | ▶ | sub install_attributes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_attributes: called CC=76 SCAR=55.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | 36 | my ($builder, $qname, $has, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | 36 | ▶ | $opts ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$opts ||= {}
MC/DC100%1/1
$opts ||= {}
$opts
Truth table100%2/2
A
A= $opts
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | 36 | ▶ | my $prefix = $opts->{prefix} || $builder->_detect_prefix($qname); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$opts->{'prefix'} || $builder->_detect_prefix($qname)
MC/DC100%2/2
$opts->{'prefix'} || $builder->_detect_prefix($qname)
$opts->{'prefix'}
$builder->_detect_prefix($qname)
Truth table100%3/3
A || B
A= $opts->{'prefix'}B= $builder->_detect_prefix($qname)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | 36 | ▶ | my $toolkit = $opts->{toolkit} || $builder->_detect_toolkit($qname); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$opts->{'toolkit'} || $builder->_detect_toolkit($qname)
MC/DC0%0/2
$opts->{'toolkit'} || $builder->_detect_toolkit($qname)
$opts->{'toolkit'}
$builder->_detect_toolkit($qname)
Truth table66%2/3
A || B
A= $opts->{'toolkit'}B= $builder->_detect_toolkit($qname)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | 36 | ▶ | my $types = $opts->{type_library} || $builder->_detect_type_library($qname); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$opts->{'type_library'} || $builder->_detect_type_library($qname)
MC/DC0%0/2
$opts->{'type_library'} || $builder->_detect_type_library($qname)
$opts->{'type_library'}
$builder->_detect_type_library($qname)
Truth table66%2/3
A || B
A= $opts->{'type_library'}B= $builder->_detect_type_library($qname)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | 36 | ▶ | my $reg = $opts->{reg} || 'Type::Registry'->for_class($qname); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$opts->{'reg'} || 'Type::Registry'->for_class($qname)
MC/DC0%0/2
$opts->{'reg'} || 'Type::Registry'->for_class($qname)
$opts->{'reg'}
'Type::Registry'->for_class($qname)
Truth table33%1/3
A || B
A= $opts->{'reg'}B= 'Type::Registry'->for_class($qname)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | 36 | my $installer = 'make_attribute_' . lc $toolkit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | 36 | my @attrs = $has->$_handle_list_add_nulls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | 36 | my $make_immutable = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | 36 | ▶ | my $meta = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | ( $toolkit eq 'Moose' ) ? Moose::Util::find_meta( $qname ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | ( $toolkit eq 'Mouse' ) ? Mouse::Util::find_meta( $qname ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | 36 | ▶ | if ( $meta and $meta->is_immutable ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$meta and $meta->is_immutable
MC/DC0%0/2
$meta and $meta->is_immutable
$meta
$meta->is_immutable
Truth table66%2/3
A and B
A= $metaB= $meta->is_immutable
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | 0 | $meta->make_mutable; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | 0 | $make_immutable = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | 36 | ▶ | while (@attrs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | 57 | my ($attrname, $attrspec) = splice @attrs, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | 57 | my %spec_hints; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | 57 | ▶ | if ($attrname =~ /^(\+?)(\$|\%|\@)(.+)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | $spec_hints{isa} ||= { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | '$' => ($nondeep ||= ((~ArrayRef)&(~HashRef))), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | '@' => ArrayLike, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | '%' => HashLike, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | 7 | ▶ | }->{$2}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
$spec_hints{"isa"} ||= {"\$", $nondeep ||= ~&ArrayRef() & ~&HashRef(), "\@", &ArrayLike(), "%", &HashLike()}->{$2}
$nondeep ||= ~&ArrayRef() & ~&HashRef()
MC/DC0%0/2
$spec_hints{"isa"} ||= {"\$", $nondeep ||= ~&ArrayRef() & ~&HashRef(), "\@", &ArrayLike(), "%", &HashLike()}->{$2}
$spec_hints{"isa"}
{"\$", $nondeep ||= ~&ArrayRef() & ~&HashRef(), "\@", &ArrayLike(), "%", &HashLike()}->{$2}
MC/DC0%0/2
$nondeep ||= ~&ArrayRef() & ~&HashRef()
$nondeep
~&ArrayRef() & ~&HashRef()
Truth table33%1/3
A ||= B
A= $spec_hints{"isa"}B= {"\$", $nondeep ||= ~&ArrayRef() & ~&HashRef(), "\@", &ArrayLike(), "%", &HashLike()}->{$2}
Truth table66%2/3
A ||= B
A= $nondeepB= ~&ArrayRef() & ~&HashRef()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | 40 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | 7 | $attrname = $1.$3; # allow plus before sigil | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | 57 | ▶ | if ($attrname =~ /^(.+)\!$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | 9 | $spec_hints{required} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | 9 | $attrname = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | 57 | (my $buildername = "_build_$attrname") =~ s/\+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | 57 | ▶ | (my $clearername = ($attrname =~ /^_/ ? "_clear$attrname" : "clear_$attrname")) =~ s/\+//; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | my %spec = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | is_CodeRef($attrspec) ? (is => $opts->{default_is}, lazy => 1, builder => $attrspec, clearer => $clearername) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | 57 | ▶ | is_Object($attrspec) && $attrspec->can('check') ? (is => $opts->{default_is}, isa => $attrspec) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
is_Object($attrspec) and $attrspec->can("check")
MC/DC50%1/2
is_Object($attrspec) and $attrspec->can("check")
is_Object($attrspec)
$attrspec->can("check")
Truth table66%2/3
A and B
A= is_Object($attrspec)B= $attrspec->can("check")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | $attrspec->$_handle_list; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | 57 | ▶ | if (is_CodeRef $spec{builder}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | 3 | my $code = delete $spec{builder}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | 3 | $spec{builder} = $buildername; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | 3 | $builder->install_methods($qname, { $buildername => $code }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | 57 | ▶ | if (defined $spec{clearer} and !ref $spec{clearer} and $spec{clearer} eq 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
defined $spec{"clearer"} and not ref $spec{"clearer"} and $spec{"clearer"} eq 1
defined $spec{"clearer"} and not ref $spec{"clearer"}
MC/DC0%0/3
defined $spec{"clearer"} and not ref $spec{"clearer"} and $spec{"clearer"} eq 1
defined $spec{"clearer"}
not ref $spec{"clearer"}
$spec{"clearer"} eq 1
Truth table75%3/4
A and not(B) and C
A= defined $spec{"clearer"}B= not ref $spec{"clearer"}C= $spec{"clearer"} eq 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | 0 | $spec{clearer} = $clearername; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | 57 | %spec = (%spec_hints, %spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | 57 | ▶ | $spec{is} ||= ($opts->{default_is} || 'ro'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition80%4/5
$spec{"is"} ||= $opts->{"default_is"} || "ro"
$opts->{'default_is'} || 'ro'
MC/DC0%0/2
$spec{"is"} ||= $opts->{"default_is"} || "ro"
$spec{"is"}
$opts->{'default_is'}
Truth table66%2/3
A ||= B
A= $spec{"is"}B= $opts->{'default_is'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | 57 | ▶ | if ($spec{is} eq 'lazy') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | 1 | $spec{is} = 'ro'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | 1 | $spec{lazy} = !!1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | 1 | ▶ | $spec{builder} ||= $buildername unless exists $spec{default}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$spec{"builder"} ||= $buildername
MC/DC0%0/2
$spec{"builder"} ||= $buildername
$spec{"builder"}
$buildername
Truth table33%1/3
A ||= B
A= $spec{"builder"}B= $buildername
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | elsif ($spec{is} eq 'private') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | 2 | $spec{is} = 'rw'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | 2 | $spec{lazy} = !!1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | 2 | $spec{init_arg} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | 2 | $spec{lexical} = !!1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | 57 | ▶ | if ($spec{does}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | 0 | my $target = $builder->qualify_name(delete($spec{does}), $prefix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | 0 | ▶ | $spec{isa} ||= $types->get_type_for_package(role => $target) if $types; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$spec{"isa"} ||= $types->get_type_for_package("role", $target)
MC/DC0%0/2
$spec{"isa"} ||= $types->get_type_for_package("role", $target)
$spec{"isa"}
$types->get_type_for_package("role", $target)
Truth table0%0/3
A ||= B
A= $spec{"isa"}B= $types->get_type_for_package("role", $target)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | 0 | ▶ | $spec{isa} ||= ConsumerOf->of($target); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$spec{"isa"} ||= &ConsumerOf()->of($target)
MC/DC0%0/2
$spec{"isa"} ||= &ConsumerOf()->of($target)
$spec{"isa"}
&ConsumerOf()->of($target)
Truth table0%0/3
A ||= B
A= $spec{"isa"}B= &ConsumerOf()->of($target)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | 57 | ▶ | if ($spec{isa} && !ref $spec{isa}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$spec{"isa"} and not ref $spec{"isa"}
MC/DC100%2/2
$spec{"isa"} and not ref $spec{"isa"}
$spec{"isa"}
not ref $spec{"isa"}
Truth table100%3/3
A and not(B)
A= $spec{"isa"}B= not ref $spec{"isa"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | 7 | my $target = $builder->qualify_name(delete($spec{isa}), $prefix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | 7 | ▶ | $spec{isa} ||= $types->get_type_for_package(class => $target) if $types; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$spec{"isa"} ||= $types->get_type_for_package("class", $target)
MC/DC0%0/2
$spec{"isa"} ||= $types->get_type_for_package("class", $target)
$spec{"isa"}
$types->get_type_for_package("class", $target)
Truth table33%1/3
A ||= B
A= $spec{"isa"}B= $types->get_type_for_package("class", $target)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | 7 | ▶ | $spec{isa} ||= InstanceOf->of($target); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$spec{"isa"} ||= &InstanceOf()->of($target)
MC/DC0%0/2
$spec{"isa"} ||= &InstanceOf()->of($target)
$spec{"isa"}
&InstanceOf()->of($target)
Truth table33%1/3
A ||= B
A= $spec{"isa"}B= &InstanceOf()->of($target)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | 57 | ▶ | if ($spec{enum}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | 8 | $spec{isa} = Enum->of(@{delete $spec{enum}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | 57 | ▶ | if (is_Object($spec{type}) and $spec{type}->can('check')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
is_Object($spec{"type"}) and $spec{"type"}->can("check")
MC/DC50%1/2
is_Object($spec{"type"}) and $spec{"type"}->can("check")
is_Object($spec{"type"})
$spec{"type"}->can("check")
Truth table66%2/3
A and B
A= is_Object($spec{"type"})B= $spec{"type"}->can("check")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | 3 | $spec{isa} = delete $spec{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | elsif ($spec{type}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | 9 | ▶ | $reg ||= 'Type::Registry'->for_class($qname); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$reg ||= "Type::Registry"->for_class($qname)
MC/DC0%0/2
$reg ||= "Type::Registry"->for_class($qname)
$reg
"Type::Registry"->for_class($qname)
Truth table33%1/3
A ||= B
A= $regB= "Type::Registry"->for_class($qname)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | 9 | $spec{isa} = $reg->lookup(delete $spec{type}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | 57 | ▶ | if (ref $spec{isa} && !exists $spec{coerce} && $spec{isa}->has_coercion) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
ref $spec{"isa"} and not exists $spec{"coerce"} and $spec{"isa"}->has_coercion
ref $spec{"isa"} and not exists $spec{"coerce"}
MC/DC100%3/3
ref $spec{"isa"} and not exists $spec{"coerce"} and $spec{"isa"}->has_coercion
ref $spec{"isa"}
not exists $spec{"coerce"}
$spec{"isa"}->has_coercion
Truth table100%4/4
A and not(B) and C
A= ref $spec{"isa"}B= not exists $spec{"coerce"}C= $spec{"isa"}->has_coercion
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | 7 | $spec{coerce} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | 57 | ▶ | if ($toolkit ne 'Moo') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | 23 | ▶ | if (defined $spec{trigger} and !ref $spec{trigger} and $spec{trigger} eq 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
defined $spec{"trigger"} and not ref $spec{"trigger"} and $spec{"trigger"} eq 1
defined $spec{"trigger"} and not ref $spec{"trigger"}
MC/DC33%1/3
defined $spec{"trigger"} and not ref $spec{"trigger"} and $spec{"trigger"} eq 1
defined $spec{"trigger"}
not ref $spec{"trigger"}
$spec{"trigger"} eq 1
Truth table50%2/4
A and not(B) and C
A= defined $spec{"trigger"}B= not ref $spec{"trigger"}C= $spec{"trigger"} eq 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | 1 | $spec{trigger} = sprintf('_trigger_%s', $attrname); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | 23 | ▶ | if (defined $spec{trigger} and !ref $spec{trigger}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $spec{"trigger"} and not ref $spec{"trigger"}
MC/DC50%1/2
defined $spec{"trigger"} and not ref $spec{"trigger"}
defined $spec{"trigger"}
not ref $spec{"trigger"}
Truth table66%2/3
A and not(B)
A= defined $spec{"trigger"}B= not ref $spec{"trigger"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | 1 | my $trigger_method = delete $spec{trigger}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | 1 | ▶ | $spec{trigger} = sub { shift->$trigger_method(@_) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | 23 | ▶ | if ($spec{is} eq 'rwp') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | 0 | $spec{is} = 'ro'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | 0 | ▶ | $spec{writer} = '_set_'.$attrname unless exists $spec{writer}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | 57 | ▶ | if (is_CodeRef $spec{coerce}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | 1 | $spec{isa} = $spec{isa}->no_coercions->plus_coercions(Types::Standard::Any, $spec{coerce}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | 1 | $spec{coerce} = !!1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | 57 | ▶ | if ( is_ScalarRef $spec{default} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | 0 | require Ask::Question; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | 0 | my $text = ${ $spec{default} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | 0 | $spec{default} = 'Ask::Question'->new( { text => $text } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | 57 | ▶ | if ( is_Object $spec{default} and $spec{default}->isa('Ask::Question') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
is_Object($spec{"default"}) and $spec{"default"}->isa("Ask::Question")
MC/DC0%0/2
is_Object($spec{"default"}) and $spec{"default"}->isa("Ask::Question")
is_Object($spec{"default"})
$spec{"default"}->isa("Ask::Question")
Truth table33%1/3
A and B
A= is_Object($spec{"default"})B= $spec{"default"}->isa("Ask::Question")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 0 | my %spec_copy = %spec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | 0 | my $default = delete $spec_copy{default}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | 0 | ▶ | if ( $spec{isa} and not $default->has_type ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$spec{"isa"} and not $default->has_type
MC/DC0%0/2
$spec{"isa"} and not $default->has_type
$spec{"isa"}
not $default->has_type
Truth table0%0/3
A and not(B)
A= $spec{"isa"}B= not $default->has_type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | 0 | $default->_set_type( $spec{isa} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | 0 | ▶ | if ( not $default->has_spec ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | 0 | $default->_set_spec( \%spec_copy ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | 0 | ▶ | if ( not $default->has_title ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | 0 | $default->_set_title( "$qname\::$attrname" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | 57 | my $default_codulate = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | # Mouse doesn't support overloaded objects as defaults. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | 57 | ▶ | if ( $toolkit eq 'Mouse' and is_Object $spec{default} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$toolkit eq "Mouse" and is_Object($spec{"default"})
MC/DC0%0/2
$toolkit eq "Mouse" and is_Object($spec{"default"})
$toolkit eq "Mouse"
is_Object($spec{"default"})
Truth table66%2/3
A and B
A= $toolkit eq "Mouse"B= is_Object($spec{"default"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | 0 | $default_codulate = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | # Moose doesn't usually either | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | ▶ | elsif ( $toolkit eq 'Moose' and is_Object $spec{default} and not $spec{default}->isa('Class::MOP::Method') ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
$toolkit eq "Moose" and is_Object($spec{"default"}) and not $spec{"default"}->isa("Class::MOP::Method")
$toolkit eq "Moose" and is_Object($spec{"default"})
MC/DC0%0/3
$toolkit eq "Moose" and is_Object($spec{"default"}) and not $spec{"default"}->isa("Class::MOP::Method")
$toolkit eq "Moose"
is_Object($spec{"default"})
not $spec{"default"}->isa("Class::MOP::Method")
Truth table50%2/4
A and B and not(C)
A= $toolkit eq "Moose"B= is_Object($spec{"default"})C= not $spec{"default"}->isa("Class::MOP::Method")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | 0 | $default_codulate = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | 57 | ▶ | if ( $default_codulate ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | 0 | my $deref = eval { \&{ $spec{default} } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | 0 | ▶ | if ( is_CodeRef $deref ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | 0 | $spec{default} = $deref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | 57 | ▶ | if ($spec{lexical}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | 2 | require Lexical::Accessor; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | 2 | ▶ | if ($spec{traits} || $spec{handles_via}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$spec{"traits"} or $spec{"handles_via"}
MC/DC50%1/2
$spec{"traits"} or $spec{"handles_via"}
$spec{"traits"}
$spec{"handles_via"}
Truth table66%2/3
A or B
A= $spec{"traits"}B= $spec{"handles_via"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | 1 | 'Lexical::Accessor'->VERSION('0.010'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | 2 | my $la = 'Lexical::Accessor'->new_from_has( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | $attrname, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | package => $qname, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | %spec, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | 2 | $la->install_accessors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | 55 | my ($shv_toolkit, $shv_data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | 55 | my $lex = $builder->_pre_attribute($qname, $attrname, \%spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | 55 | ▶ | if ($spec{handles_via}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | 5 | $shv_toolkit = "Sub::HandlesVia::Toolkit::$toolkit"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | 5 | use_module($shv_toolkit); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | 5 | $shv_data = $shv_toolkit->clean_spec($qname, $attrname, \%spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | 55 | $builder->$installer($qname, $attrname, \%spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | 54 | ▶ | $shv_toolkit->install_delegations($shv_data) if $shv_data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | 54 | ▶ | $builder->_post_attribute($qname, $attrname, \%spec, $lex) if $lex; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | 35 | ▶ | $meta->make_immutable if $make_immutable; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | 35 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | 57 | ▶ | sub _pre_attribute { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_pre_attribute: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | 55 | my ($builder, $target, $attrname, $spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | 55 | my %lex; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | 55 | for my $thing (qw/ reader writer accessor clearer predicate /) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | 275 | ▶ | if (is_ScalarRef $spec->{$thing}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | 3 | my $rand = sprintf('__lexical_%d', 10_000_000 + int rand(89_000_000)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | 3 | $lex{$rand} = $spec->{$thing}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | 3 | $spec->{$thing} = $rand; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | 55 | ▶ | if (is_ArrayRef $spec->{handles}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | 1 | my %new_handles; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | 1 | my @handles = @{$spec->{handles}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | 1 | ▶ | while (@handles) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | 3 | my ($src, $dst) = splice @handles, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | 3 | ▶ | if (is_ScalarRef $src) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | 2 | my $rand = sprintf('__lexical_%d', 10_000_000 + int rand(89_000_000)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | 2 | $new_handles{$rand} = $dst; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | 2 | $lex{$rand} = $src; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | 1 | $new_handles{$src} = $dst; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | 1 | $spec->{handles} = \%new_handles; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | 55 | ▶ | return unless keys %lex; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | 1 | \%lex; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | 8 | ▶ | sub _post_attribute { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_post_attribute: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | 1 | my ($builder, $target, $attrname, $spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | 1 | my %lex = %{ +pop }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | 1 | foreach my $tmp (sort keys %lex) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | 40 | ▶ | my $coderef = do { no strict 'refs'; \&{"$target\::$tmp"} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | 5 | ${ $lex{$tmp} } = $coderef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | 5 | 'namespace::clean'->clean_subroutines($target, $tmp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | 32 | ▶ | sub make_attribute_moo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_attribute_moo: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | 32 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | 32 | my ($class, $attribute, $spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | 32 | my $helper = $builder->_get_moo_helper($class, 'has'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | 32 | ▶ | if (is_Object($spec->{isa}) and $spec->{isa}->isa('Type::Tiny::Enum') and $spec->{handles}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
is_Object($spec->{"isa"}) and $spec->{"isa"}->isa("Type::Tiny::Enum") and $spec->{"handles"}
is_Object($spec->{"isa"}) and $spec->{"isa"}->isa("Type::Tiny::Enum")
MC/DC100%3/3
is_Object($spec->{"isa"}) and $spec->{"isa"}->isa("Type::Tiny::Enum") and $spec->{"handles"}
is_Object($spec->{"isa"})
$spec->{"isa"}->isa("Type::Tiny::Enum")
$spec->{"handles"}
Truth table100%4/4
A and B and C
A= is_Object($spec->{"isa"})B= $spec->{"isa"}->isa("Type::Tiny::Enum")C= $spec->{"handles"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | 1 | $builder->_process_enum_moo(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | 32 | $helper->($attribute, %$spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1655 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1656 | 8 | ▶ | sub _process_enum_moo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_process_enum_moo: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1657 | 1 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1658 | 1 | my ($class, $attribute, $spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1659 | 1 | require MooX::Enumeration; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1660 | 1 | my %new_spec = 'MooX::Enumeration'->process_spec($class, $attribute, %$spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1661 | 1 | ▶ | if (delete $new_spec{moox_enumeration_process_handles}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1662 | 1 | 'MooX::Enumeration'->install_delegates($class, $attribute, \%new_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1663 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1664 | 1 | %$spec = %new_spec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1665 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1667 | 12 | ▶ | sub make_attribute_moose { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_attribute_moose: called CC=6 SCAR=19.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1668 | 12 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1669 | 12 | my ($class, $attribute, $spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1670 | 12 | ▶ | if (is_Object($spec->{isa}) and $spec->{isa}->isa('Type::Tiny::Enum')||$spec->{isa}->isa('Moose::Meta::TypeConstraint::Enum') and $spec->{handles}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
is_Object($spec->{"isa"}) and $spec->{"isa"}->isa("Type::Tiny::Enum") || $spec->{"isa"}->isa("Moose::Meta::TypeConstraint::Enum") and $spec->{"handles"}
is_Object($spec->{"isa"}) and $spec->{"isa"}->isa("Type::Tiny::Enum") || $spec->{"isa"}->isa("Moose::Meta::TypeConstraint::Enum")
$spec->{"isa"}->isa("Type::Tiny::Enum") or $spec->{"isa"}->isa("Moose::Meta::TypeConstraint::Enum")
MC/DC0%0/4
is_Object($spec->{"isa"}) and $spec->{"isa"}->isa("Type::Tiny::Enum") || $spec->{"isa"}->isa("Moose::Meta::TypeConstraint::Enum") and $spec->{"handles"}
is_Object($spec->{"isa"})
$spec->{"isa"}->isa("Type::Tiny::Enum")
$spec->{"isa"}->isa("Moose::Meta::TypeConstraint::Enum")
$spec->{"handles"}
Truth table50%3/6
A and B or C and D
A= is_Object($spec->{"isa"})B= $spec->{"isa"}->isa("Type::Tiny::Enum")C= $spec->{"isa"}->isa("Moose::Meta::TypeConstraint::Enum")D= $spec->{"handles"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1671 | 0 | $builder->_process_enum_moose(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1672 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1673 | 12 | require Moose::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1674 | 12 | ▶ | (Moose::Util::find_meta($class) or $class->meta)->add_attribute($attribute, %$spec); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
Moose::Util::find_meta($class) || $class->meta
MC/DC0%0/2
Moose::Util::find_meta($class) || $class->meta
Moose::Util::find_meta($class)
$class->meta
Truth table33%1/3
A || B
A= Moose::Util::find_meta($class)B= $class->meta
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1675 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1676 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1677 | 0 | ▶ | sub _process_enum_moose { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_process_enum_moose: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1678 | 0 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1679 | 0 | my ($class, $attribute, $spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1680 | 0 | require MooseX::Enumeration; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1681 | 0 | ▶ | push @{ $spec->{traits}||=[] }, 'Enumeration'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$spec->{"traits"} ||= []
MC/DC0%0/1
$spec->{"traits"} ||= []
$spec->{"traits"}
Truth table0%0/2
A
A= $spec->{"traits"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1682 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1683 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1684 | 17 | ▶ | sub make_attribute_mouse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_attribute_mouse: called CC=5 SCAR=17.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1685 | 11 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1686 | 11 | my ($class, $attribute, $spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1687 | 11 | ▶ | if (is_Object($spec->{isa}) and $spec->{isa}->isa('Type::Tiny::Enum') and $spec->{handles}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
is_Object($spec->{"isa"}) and $spec->{"isa"}->isa("Type::Tiny::Enum") and $spec->{"handles"}
is_Object($spec->{"isa"}) and $spec->{"isa"}->isa("Type::Tiny::Enum")
MC/DC0%0/3
is_Object($spec->{"isa"}) and $spec->{"isa"}->isa("Type::Tiny::Enum") and $spec->{"handles"}
is_Object($spec->{"isa"})
$spec->{"isa"}->isa("Type::Tiny::Enum")
$spec->{"handles"}
Truth table75%3/4
A and B and C
A= is_Object($spec->{"isa"})B= $spec->{"isa"}->isa("Type::Tiny::Enum")C= $spec->{"handles"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1688 | 0 | $builder->_process_enum_mouse(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1689 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1690 | 11 | require Mouse::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1691 | 11 | my %spec = %$spec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1692 | 11 | delete $spec{definition_context}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1693 | 11 | ▶ | (Mouse::Util::find_meta($class) or $class->meta)->add_attribute($attribute, %spec); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
Mouse::Util::find_meta($class) || $class->meta
MC/DC0%0/2
Mouse::Util::find_meta($class) || $class->meta
Mouse::Util::find_meta($class)
$class->meta
Truth table33%1/3
A || B
A= Mouse::Util::find_meta($class)B= $class->meta
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1694 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1696 | 6 | ▶ | sub _process_enum_mouse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_process_enum_mouse: called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1697 | 0 | die 'not implemented'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1698 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1700 | 51 | ▶ | sub extend_class_moo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extend_class_moo: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1701 | 45 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1702 | 45 | my ($class, $isa) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1703 | 45 | my $helper = $builder->_get_moo_helper($class, 'extends'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1704 | 45 | $helper->(@$isa); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1705 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1706 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1707 | 24 | ▶ | sub extend_class_moose { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extend_class_moose: called CC=5 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1708 | 18 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1709 | 18 | my ($class, $isa) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1711 | 18 | PARENT: for my $parent ( @$isa ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1712 | 18 | ▶ | next PARENT if $parent->isa('Moose::Object'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1713 | 0 | ▶ | next PARENT if $parent->isa('Moo::Object'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1714 | 0 | use_module("MooseX::NonMoose")->import::into($class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1715 | 0 | last PARENT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1716 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1717 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1718 | 18 | require Moose::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1719 | 18 | ▶ | (Moose::Util::find_meta($class) or $class->meta)->superclasses(@$isa); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
Moose::Util::find_meta($class) || $class->meta
MC/DC0%0/2
Moose::Util::find_meta($class) || $class->meta
Moose::Util::find_meta($class)
$class->meta
Truth table33%1/3
A || B
A= Moose::Util::find_meta($class)B= $class->meta
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1720 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1721 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1722 | 18 | ▶ | sub extend_class_mouse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extend_class_mouse: called CC=4 SCAR=15.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1723 | 18 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1724 | 18 | my ($class, $isa) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1725 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1726 | 18 | PARENT: for my $parent ( @$isa ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1727 | 18 | ▶ | next PARENT if $parent->isa('Mouse::Object'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1728 | 0 | use_module("MouseX::NonMoose")->import::into($class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1729 | 0 | last PARENT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1732 | 18 | require Mouse::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1733 | 18 | ▶ | (Mouse::Util::find_meta($class) or $class->meta)->superclasses(@$isa); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
Mouse::Util::find_meta($class) || $class->meta
MC/DC0%0/2
Mouse::Util::find_meta($class) || $class->meta
Mouse::Util::find_meta($class)
$class->meta
Truth table33%1/3
A || B
A= Mouse::Util::find_meta($class)B= $class->meta
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1734 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1735 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1736 | 10 | ▶ | sub install_symmethods { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_symmethods: called CC=8 SCAR=21.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1737 | 10 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1738 | 10 | my ($target, $symm) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1739 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1740 | 10 | ▶ | my @symm = $symm->$_handle_list or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1742 | 10 | require Sub::SymMethod; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1743 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1744 | 10 | ▶ | while ( @symm ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1745 | 14 | my $name = shift(@symm); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1746 | 14 | ▶ | my $spec = is_CodeRef($symm[0]) ? { code => shift(@symm) } : shift(@symm); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1748 | 14 | ▶ | if ( $spec->{signature} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1749 | my $signature_style = CodeRef->check($spec->{signature}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1750 | ? 'code' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1751 | 2 | ▶ | : ($spec->{named} ? 'named' : 'positional'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1752 | my $new_sig = $builder->_build_method_signature_check( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1753 | $target, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1754 | $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1755 | $signature_style, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1756 | $spec->{signature}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1757 | 2 | ▶ | exists($spec->{signature}) ? $spec->{signature} : 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1758 | 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1759 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1760 | 2 | $spec->{signature} = $new_sig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1761 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1762 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1763 | 14 | 'Sub::SymMethod'->install_symmethod( $target, $name, %$spec ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1764 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1765 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1766 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1767 | 10 | ▶ | sub install_multimethod { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_multimethod: called CC=9 SCAR=33.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1768 | 10 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1769 | 10 | my ($target, $kind, $method_name, $method_spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1770 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1771 | 10 | HashRef->($method_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1772 | 10 | Ref->($method_spec->{signature}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1773 | 10 | CodeRef->($method_spec->{code}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1774 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1775 | my $signature_style = CodeRef->check($method_spec->{signature}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1776 | ? 'code' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1777 | 10 | ▶ | : ($method_spec->{named} ? 'named' : 'positional'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1778 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1779 | my $new_sig = $builder->_build_method_signature_check( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1780 | $target, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1781 | $method_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1782 | $signature_style, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1783 | $method_spec->{signature}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1784 | undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1785 | 10 | 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1786 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1787 | 10 | $method_spec->{signature} = $new_sig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1789 | 10 | ▶ | if ( match('coercion', $method_spec->{'attributes'}) or match('coerce', $method_spec->{'attributes'}) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
match("coercion", $method_spec->{"attributes"}) or match("coerce", $method_spec->{"attributes"})
MC/DC0%0/2
match("coercion", $method_spec->{"attributes"}) or match("coerce", $method_spec->{"attributes"})
match("coercion", $method_spec->{"attributes"})
match("coerce", $method_spec->{"attributes"})
Truth table33%1/3
A or B
A= match("coercion", $method_spec->{"attributes"})B= match("coerce", $method_spec->{"attributes"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1790 | 0 | my $to_type = $target->FACTORY->type_library->get_type_for_package( any => $target ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1791 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1792 | 0 | my @sigtypes = grep Scalar::Util::blessed($_), @{$method_spec->{signature}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1793 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1794 | $builder->croak('Multimethods used as coercions must take exactly one positional argument') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1795 | 0 | ▶ | unless is_ArrayRef( $method_spec->{signature} ) && 1==@sigtypes && $signature_style eq 'positional'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
is_ArrayRef($method_spec->{"signature"}) and 1 == @sigtypes and $signature_style eq "positional"
is_ArrayRef($method_spec->{"signature"}) and 1 == @sigtypes
MC/DC0%0/3
is_ArrayRef($method_spec->{"signature"}) and 1 == @sigtypes and $signature_style eq "positional"
is_ArrayRef($method_spec->{"signature"})
1 == @sigtypes
$signature_style eq "positional"
Truth table0%0/4
A and B and C
A= is_ArrayRef($method_spec->{"signature"})B= 1 == @sigtypesC= $signature_style eq "positional"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1796 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1797 | 0 | ▶ | $builder->croak("Too late to add coercion to $to_type") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1798 | if $to_type->coercion->frozen; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1799 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1800 | 0 | my $from_type = 'Type::Registry'->for_class($target)->lookup( $sigtypes[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1801 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1802 | 0 | my $code = $method_spec->{code}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1803 | 0 | ▶ | $to_type->coercion->add_type_coercions( $from_type, sub { $code->($target, $_) } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1804 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1806 | 10 | require Sub::MultiMethod; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1807 | 10 | 'Sub::MultiMethod'->install_candidate($target, $method_name, no_dispatcher=>($kind eq 'role'), %$method_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1808 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1809 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1810 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1811 | 77 | ▶ | my $_process_roles = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1812 | 77 | my ($builder, $r, $tk, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1813 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1814 | 77 | my $role = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1815 | 104 | ▶ | if ($role =~ /\?$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1816 | 2 | $role =~ s/\?$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1817 | 2 | ▶ | eval "require $role; 1" or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1818 | 1 | $builder->make_role(make_absolute_package_name($role), %$opts, toolkit => $tk); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1819 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1820 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1821 | 104 | $role; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1822 | } @$r; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1823 | 40 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1824 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1825 | 2 | ▶ | my $_maybe_do_multimethods = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=20.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1826 | 2 | my $tk = 'Sub::MultiMethod'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1827 | 2 | ▶ | if ($tk->can('copy_package_candidates') and $tk->VERSION lt '0.901') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$tk->can("copy_package_candidates") and $tk->VERSION lt "0.901"
MC/DC0%0/2
$tk->can("copy_package_candidates") and $tk->VERSION lt "0.901"
$tk->can("copy_package_candidates")
$tk->VERSION lt "0.901"
Truth table33%1/3
A and B
A= $tk->can("copy_package_candidates")B= $tk->VERSION lt "0.901"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1828 | 0 | my ($target, $kind, @sources) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1829 | 0 | $tk->copy_package_candidates(@sources => $target); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1830 | 0 | ▶ | $tk->install_missing_dispatchers($target) unless $kind eq 'role'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1831 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1832 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1833 | 40 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1834 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1835 | 45 | ▶ | sub apply_roles_moo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
apply_roles_moo: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1836 | 45 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1837 | 45 | my ($class, $kind, $roles, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1838 | 45 | my $helper = $builder->_get_moo_helper($class, 'with'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1839 | 45 | my @roles = $builder->$_process_roles($roles, 'Moo', $opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1840 | 45 | $helper->(@roles); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1841 | 45 | ▶ | $class->$_maybe_do_multimethods($kind, @roles) if $INC{'Sub/MultiMethod.pm'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1842 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1843 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1844 | 16 | ▶ | sub apply_roles_moose { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
apply_roles_moose: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1845 | 16 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1846 | 16 | my ($class, $kind, $roles, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1847 | 16 | require Moose::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1848 | 16 | my @roles = $builder->$_process_roles($roles, 'Moose', $opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1849 | 16 | Moose::Util::ensure_all_roles($class, @roles); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1850 | 16 | ▶ | $class->$_maybe_do_multimethods($kind, @roles) if $INC{'Sub/MultiMethod.pm'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1851 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1852 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1853 | 16 | ▶ | sub apply_roles_mouse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
apply_roles_mouse: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1854 | 16 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1855 | 16 | my ($class, $kind, $roles, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1856 | 16 | require Mouse::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1857 | 16 | my @roles = $builder->$_process_roles($roles, 'Mouse', $opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1858 | # this can double-apply roles? :( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1859 | 16 | Mouse::Util::apply_all_roles($class, @roles); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1860 | 16 | ▶ | $class->$_maybe_do_multimethods($kind, @roles) if $INC{'Sub/MultiMethod.pm'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1861 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1862 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1864 | 40 | ▶ | sub require_methods_moo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
require_methods_moo: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1865 | 1 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1866 | 1 | my ($role, $methods) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1867 | 1 | my $helper = $builder->_get_moo_helper($role, 'requires'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1868 | 1 | $helper->(sort keys %$methods); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1869 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1870 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1871 | 0 | ▶ | sub require_methods_moose { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
require_methods_moose: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1872 | 0 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1873 | 0 | my ($role, $methods) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1874 | 0 | require Moose::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1875 | 0 | ▶ | (Moose::Util::find_meta($role) or $role->meta)->add_required_methods(sort keys %$methods); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
Moose::Util::find_meta($role) || $role->meta
MC/DC0%0/2
Moose::Util::find_meta($role) || $role->meta
Moose::Util::find_meta($role)
$role->meta
Truth table0%0/3
A || B
A= Moose::Util::find_meta($role)B= $role->meta
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1876 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1877 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1878 | 0 | ▶ | sub require_methods_mouse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
require_methods_mouse: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1879 | 0 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1880 | 0 | my ($role, $methods) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1881 | 0 | require Mouse::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1882 | 0 | ▶ | (Mouse::Util::find_meta($role) or $role->meta)->add_required_methods(sort keys %$methods); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
Mouse::Util::find_meta($role) || $role->meta
MC/DC0%0/2
Mouse::Util::find_meta($role) || $role->meta
Mouse::Util::find_meta($role)
$role->meta
Truth table0%0/3
A || B
A= Mouse::Util::find_meta($role)B= $role->meta
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1883 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1884 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1885 | 1 | ▶ | sub wrap_coderef { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wrap_coderef: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1886 | 1 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1887 | 1 | ▶ | my %method = (@_==1) ? %{$_[0]} : @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1888 | 1 | ▶ | my $qname = delete($method{package}) || caller; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
delete $method{'package'} || caller
MC/DC0%0/2
delete $method{'package'} || caller
delete $method{'package'}
caller
Truth table33%1/3
A || B
A= delete $method{'package'}B= caller
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1889 | 1 | $method{lexical} = !!1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1890 | 1 | my $return = $builder->install_methods($qname, { '__ANON__' => \%method }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1891 | 1 | $return->{'__ANON__'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1892 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1893 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1894 | 105 | ▶ | sub install_methods { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_methods: called CC=38 SCAR=38.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1895 | 105 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1896 | 105 | my ($class, $methods) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1897 | 105 | my %return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1898 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1899 | my $to_type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1900 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1901 | 105 | for my $name (sort keys %$methods) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1902 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1903 | 208 | my ($code, $signature, $signature_style, $invocant_count, $is_coderef, $caller, $attrs, @curry, $ctx); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1904 | 208 | $caller = $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1905 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1906 | 208 | ▶ | if (is_CodeRef($methods->{$name})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1907 | 169 | $code = $methods->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1908 | 169 | $signature_style = 'none'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1909 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1910 | elsif (is_HashRef($methods->{$name})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1911 | 39 | $attrs = $methods->{$name}{attributes}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1912 | 39 | $code = $methods->{$name}{code}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1913 | 39 | $signature = $methods->{$name}{signature}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1914 | 39 | ▶ | @curry = @{ $methods->{$name}{curry} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$methods->{$name}{'curry'} || []
MC/DC100%1/1
$methods->{$name}{'curry'} || []
$methods->{$name}{'curry'}
Truth table100%2/2
A
A= $methods->{$name}{'curry'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1915 | 39 | ▶ | $invocant_count = exists($methods->{$name}{invocant_count}) ? $methods->{$name}{invocant_count} : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1916 | $signature_style = is_CodeRef($signature) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1917 | ? 'code' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1918 | 39 | ▶ | : ($methods->{$name}{named} ? 'named' : 'positional'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1919 | 39 | $is_coderef = !!$methods->{$name}{lexical}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1920 | 39 | $caller = $methods->{$name}{caller}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1921 | 39 | $ctx = $methods->{$name}{'definition_context'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1922 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1923 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1924 | 208 | ▶ | if ($signature) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1925 | 6 | ▶ | CodeRef->assert_valid($signature) if $signature_style eq 'code'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1926 | 6 | ▶ | ArrayRef->assert_valid($signature) if $signature_style eq 'named'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1927 | 6 | ▶ | ArrayRef->assert_valid($signature) if $signature_style eq 'positional'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1928 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1929 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1930 | 208 | my $optimized = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1931 | 208 | my $checkcode = '&$check'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1932 | 208 | ▶ | if ($signature and $methods->{$name}{optimize}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$signature and $methods->{$name}{"optimize"}
MC/DC100%2/2
$signature and $methods->{$name}{"optimize"}
$signature
$methods->{$name}{"optimize"}
Truth table100%3/3
A and B
A= $signatureB= $methods->{$name}{"optimize"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1933 | 2 | ▶ | if (my $r = $builder->_optimize_signature($class, "$class\::$name", $signature_style, $signature)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1934 | 2 | $checkcode = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1935 | 2 | ++$optimized; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1936 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1937 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1938 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1939 | 208 | my $callcode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1940 | 208 | ▶ | if (is_CodeRef($code)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1941 | 203 | $callcode = 'goto $code'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1942 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1943 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1944 | 5 | ($callcode = $code) =~ s/\A \s* sub \s* \{ (.+) \} \s* \z/$1/xs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1945 | 5 | ▶ | $callcode = "package $caller; $callcode" if defined $caller; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1946 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1947 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1948 | 208 | ▶ | my $attrs_string = $is_coderef ? "" : ":method"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1949 | 208 | ▶ | $attrs_string .= " :lvalue" if match("lvalue", $attrs); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1950 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1951 | 208 | my $magic_comment = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1952 | 208 | ▶ | if ($ctx) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1953 | 21 | $magic_comment = sprintf("#line %d \"%s\"\n", $ctx->{line}, $ctx->{file}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1954 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1955 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1956 | 40 | ▶ | no warnings 'printf'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1957 | 208 | ▶ | my $subcode = sprintf( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
Condition100%6/6
$signature and not $optimized
$signature and not $optimized
MC/DC100%2/2
$signature and not $optimized
$signature
not $optimized
MC/DC100%2/2
$signature and not $optimized
$signature
not $optimized
Truth table100%3/3
A and not(B)
A= $signatureB= not $optimized
Truth table100%3/3
A and not(B)
A= $signatureB= not $optimized
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1958 | q{%s} . # magic comment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1959 | q{package %-49s} . # package name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1960 | q{%-49s} . # my $check variable to close over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1961 | q{sub %-49s} . # method name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1962 | q[{] . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1963 | q{%-49s} . # strip @invocants from @_ if necessary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1964 | q{%-49s} . # build $check | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1965 | q{%-49s} . # reassemble @_ from @invocants, @curry, and &$check | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1966 | q{%-49s} . # run sub code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1967 | q[};] . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1968 | q[%s] # 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1969 | , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1970 | $magic_comment, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1971 | "$class;", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1972 | (($signature && !$optimized) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1973 | ? 'my $check;' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1974 | : ''), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1975 | ($is_coderef ? $attrs_string : "$name $attrs_string"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1976 | ($signature | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1977 | ? sprintf('my @invocants = splice(@_, 0, %d);', $invocant_count) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1978 | : ''), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1979 | (($signature && !$optimized) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1980 | ? sprintf('$check ||= do { my $tmp = %s->_build_method_signature_check(%s, %s, %s, $signature, \\@invocants); ref($tmp) eq q(HASH) ? $tmp->{closure} : $tmp };', map(B::perlstring($_), $builder, $class, "$class\::$name", $signature_style)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1981 | : ''), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1982 | ($signature | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1983 | ? (@curry ? sprintf('@_ = (@invocants, @curry, %s);', $checkcode) : sprintf('@_ = (@invocants, %s);', $checkcode)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1984 | : (@curry ? sprintf('splice(@_, %d, 0, @curry);', $invocant_count) : '')), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1985 | $callcode, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1986 | ($is_coderef ? '' : '1;'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1987 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1988 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1989 | 40 | ▶ | no warnings 'closure'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1990 | 208 | ▶ | ($return{$name} = eval($subcode)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_class: called CC=1 SCAR=0.0
Subroutine
get_role: called CC=1 SCAR=0.0
Subroutine
qualify: called CC=1 SCAR=0.0
Pod
undocumented
Pod
undocumented
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1991 | or $builder->croak("Could not create method $name in package $class: $@"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1992 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1993 | 208 | ▶ | if ( match('coercion', $attrs) or match('coerce', $attrs) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
match("coercion", $attrs) or match("coerce", $attrs)
MC/DC0%0/2
match("coercion", $attrs) or match("coerce", $attrs)
match("coercion", $attrs)
match("coerce", $attrs)
Truth table33%1/3
A or B
A= match("coercion", $attrs)B= match("coerce", $attrs)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1994 | 0 | my @sigtypes = grep !is_HashRef($_), @$signature; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1995 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1996 | 0 | ▶ | $to_type ||= $class->FACTORY->type_library->get_type_for_package( any => $class ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$to_type ||= $class->FACTORY->type_library->get_type_for_package("any", $class)
MC/DC0%0/2
$to_type ||= $class->FACTORY->type_library->get_type_for_package("any", $class)
$to_type
$class->FACTORY->type_library->get_type_for_package("any", $class)
Truth table0%0/3
A ||= B
A= $to_typeB= $class->FACTORY->type_library->get_type_for_package("any", $class)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1997 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1998 | 0 | ▶ | $builder->croak('Methods used as coercions must take exactly one positional argument') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
is_ArrayRef($signature) and 1 == @sigtypes and $signature_style eq "positional"
is_ArrayRef($signature) and 1 == @sigtypes
MC/DC0%0/3
is_ArrayRef($signature) and 1 == @sigtypes and $signature_style eq "positional"
is_ArrayRef($signature)
1 == @sigtypes
$signature_style eq "positional"
Truth table0%0/4
A and B and C
A= is_ArrayRef($signature)B= 1 == @sigtypesC= $signature_style eq "positional"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1999 | unless is_ArrayRef( $signature ) && 1==@sigtypes && $signature_style eq 'positional'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2000 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2001 | 0 | ▶ | $builder->croak("Too late to add coercion to $to_type") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2002 | if $to_type->coercion->frozen; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2003 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2004 | 0 | my $from_type = 'Type::Registry'->for_class($class)->lookup( $sigtypes[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2005 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2006 | 0 | $to_type->coercion->add_type_coercions( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2007 | $from_type, sprintf('%s->%s($_)', B::perlstring($class), $name), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2008 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2009 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2010 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2011 | 105 | \%return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2012 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2013 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2014 | 21 | ▶ | sub _optimize_signature { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_optimize_signature: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2015 | 22 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2016 | 24 | my ($method_class, $method_name, $signature_style, $signature) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2017 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2018 | 14 | ▶ | $signature_style ||= 'none' if !$signature; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$signature_style ||= "none"
MC/DC100%1/1
$signature_style ||= "none"
$signature_style
Truth table100%2/2
A
A= $signature_style
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2019 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2020 | 14 | ▶ | return if $signature_style eq 'none'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2021 | 7 | ▶ | return if $signature_style eq 'code'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2022 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2023 | 4 | my @sig = @$signature; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2024 | 7 | require Type::Params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2025 | 6 | my $global_opts = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2026 | 6 | ▶ | $global_opts = shift(@sig) if is_HashRef($sig[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2027 | 6 | $global_opts->{want_details} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2028 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2029 | 6 | my $details = $builder->_build_method_signature_check($method_class, $method_name, $signature_style, [$global_opts, @sig]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2030 | 5 | ▶ | return if keys %{$details->{environment}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2031 | 4 | ▶ | return if $details->{source} =~ /return/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2032 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2033 | 5 | ▶ | $details->{source} =~ /^sub \{(.+)\};?$/s or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2034 | 5 | return "do { $1 }"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2035 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2036 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2037 | # need to partially parse stuff for Type::Params to look up type names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2038 | 39 | ▶ | sub _build_method_signature_check { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_method_signature_check: called CC=24 SCAR=37.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2039 | 23 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2040 | 22 | my ($method_class, $method_name, $signature_style, $signature, $invocants, $gimme_list) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2041 | 22 | my $type_library; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2042 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2043 | 22 | ▶ | $signature_style ||= 'none' if !$signature; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$signature_style ||= "none"
MC/DC0%0/1
$signature_style ||= "none"
$signature_style
Truth table50%1/2
A
A= $signature_style
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2044 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2045 | 0 | ▶ | return sub { @_ } if $signature_style eq 'none'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2046 | 22 | ▶ | return $signature if $signature_style eq 'code'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2047 | 21 | my @sig = @$signature; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2048 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2049 | 21 | require Type::Params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2050 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2051 | 20 | my $global_opts = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2052 | 20 | ▶ | $global_opts = shift(@sig) if is_HashRef($sig[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2053 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2054 | 20 | ▶ | $global_opts->{subname} ||= $method_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$global_opts->{"subname"} ||= $method_name
MC/DC50%1/2
$global_opts->{"subname"} ||= $method_name
$global_opts->{"subname"}
$method_name
Truth table66%2/3
A ||= B
A= $global_opts->{"subname"}B= $method_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2055 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2056 | 20 | my $is_named = ($signature_style eq 'named'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2057 | 20 | my @params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2058 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2059 | my $reg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2060 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2061 | 20 | ▶ | while (@sig) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2062 | 29 | my ($name, $type, $opts) = (undef, undef, {}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2063 | 28 | ▶ | if ($is_named) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2064 | 5 | ($name, $type) = splice(@sig, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2065 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2066 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2067 | 23 | $type = shift(@sig); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2068 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2069 | 28 | ▶ | if ( is_HashRef $sig[0] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2070 | 0 | $opts = shift(@sig); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2071 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2072 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2073 | # All that work, just to do this!!! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2074 | 28 | ▶ | if (is_Str($type) and not $type =~ /^[01]$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
is_Str($type) and not $type =~ /^[01]$/
MC/DC50%1/2
is_Str($type) and not $type =~ /^[01]$/
is_Str($type)
not $type =~ /^[01]$/
Truth table66%2/3
A and not(B)
A= is_Str($type)B= not $type =~ /^[01]$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2075 | 15 | ▶ | $reg ||= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$reg ||= do {
require Type::Registry;
"Type::Registry"->for_class($method_class)
}
MC/DC0%0/2
$reg ||= do {
require Type::Registry;
"Type::Registry"->for_class($method_class)
}
$reg
do {
require Type::Registry;
"Type::Registry"->for_class($method_class)
}
Truth table0%0/3
A ||= B
A= $regB= do {
require Type::Registry;
"Type::Registry"->for_class($method_class)
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2076 | 12 | require Type::Registry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2077 | 12 | 'Type::Registry'->for_class($method_class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2078 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2079 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2080 | 15 | ▶ | if ($type =~ /^\%/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2081 | 0 | $type = HashRef->of( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2082 | $reg->lookup(substr($type, 1)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2083 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2084 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2085 | elsif ($type =~ /^\@/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2086 | 0 | $type = ArrayRef->of( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2087 | $reg->lookup(substr($type, 1)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2088 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2089 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2090 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2091 | 15 | $type = $reg->lookup($type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2092 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2093 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2094 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2095 | push( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2096 | 28 | ▶ | @params, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2097 | $is_named | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2098 | ? ($name, $type, $opts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2099 | : ( $type, $opts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2100 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2103 | 19 | for my $position (qw( head tail )) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2104 | 38 | ▶ | if (ref $global_opts->{$position}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2105 | 0 | require Type::Params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2106 | 0 | 'Type::Params'->VERSION(1.009002); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2107 | 0 | ▶ | $reg ||= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$reg ||= do {
require Type::Registry;
"Type::Registry"->for_class($method_class)
}
MC/DC0%0/2
$reg ||= do {
require Type::Registry;
"Type::Registry"->for_class($method_class)
}
$reg
do {
require Type::Registry;
"Type::Registry"->for_class($method_class)
}
Truth table33%1/3
A ||= B
A= $regB= do {
require Type::Registry;
"Type::Registry"->for_class($method_class)
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2108 | 0 | require Type::Registry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2109 | 0 | 'Type::Registry'->for_class($method_class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2110 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2111 | $global_opts->{$position} = [map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2112 | 0 | my $type = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2113 | 0 | ▶ | if (ref $type) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2114 | 0 | $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2116 | elsif ($type =~ /^\%/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2117 | 0 | HashRef->of( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2118 | $reg->lookup(substr($type, 1)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2119 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2121 | elsif ($type =~ /^\@/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2122 | 0 | ArrayRef->of( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2123 | $reg->lookup(substr($type, 1)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2124 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2126 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2127 | 0 | $reg->lookup($type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2129 | 0 | } @{$global_opts->{$position}} ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2133 | 19 | ▶ | my $next = $is_named ? \&Type::Params::compile_named_oo : \&Type::Params::compile; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2134 | 19 | @_ = ($global_opts, @params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2135 | 19 | ▶ | return [@_] if $gimme_list; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2136 | 7 | goto $next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2139 | 10 | ▶ | sub install_constants { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_constants: called CC=6 SCAR=19.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2140 | 10 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2141 | 10 | my ($class, $methods) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2142 | 10 | for my $name (sort keys %$methods) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2143 | 40 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2144 | 15 | my $value = $methods->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2145 | 15 | ▶ | if (defined $value && !ref $value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $value and not ref $value
MC/DC0%0/2
defined $value and not ref $value
defined $value
not ref $value
Truth table33%1/3
A and not(B)
A= defined $valueB= not ref $value
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2146 | 15 | require B; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2147 | 15 | my $stringy = B::perlstring($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2148 | 15 | ▶ | eval "package $class; sub $name () { $stringy }; 1" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2149 | or $builder->croak("Could not create constant $name in package $class: $@"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2151 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2152 | 0 | ▶ | eval "package $class; sub $name () { \$value }; 1" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2153 | or $builder->croak("Could not create constant $name in package $class: $@"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2158 | 24 | ▶ | sub _prepare_method_modifier { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_prepare_method_modifier: called CC=9 SCAR=23.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2159 | 24 | my ($builder, $class, $kind, $names, $method) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2160 | 24 | ▶ | return $method if is_CodeRef $method; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2162 | 2 | my $coderef = $method->{code}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2163 | 2 | my $signature = $method->{signature}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2164 | 2 | ▶ | my @curry = @{ $method->{curry} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$method->{'curry'} || []
MC/DC0%0/1
$method->{'curry'} || []
$method->{'curry'}
Truth table50%1/2
A
A= $method->{'curry'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2165 | 2 | ▶ | my $signature_style = $method->{named} ? 'named' : 'positional'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2167 | 2 | ▶ | return $coderef unless $signature || @curry; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$signature or @curry
MC/DC0%0/2
$signature or @curry
$signature
@curry
Truth table33%1/3
A or B
A= $signatureB= @curry
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2168 | 0 | ▶ | $signature ||= sub { @_ }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=2.0
Condition33%1/3
$signature ||= sub {
@_;
}
MC/DC0%0/2
$signature ||= sub {
@_;
}
$signature
sub {
@_;
}
Truth table33%1/3
A ||= B
A= $signatureB= sub {
@_;
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2170 | 2 | my $invocant_count = 1 + !!($kind eq 'around'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2171 | 2 | ▶ | $invocant_count = $method->{invocant_count} if exists $method->{invocant_count}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2173 | 2 | my $name = join('|', @$names)."($kind)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2175 | 40 | ▶ | no warnings 'closure'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2176 | 2 | my $wrapped = eval qq{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2177 | my \$check; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2178 | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2179 | my \@invocants = splice(\@_, 0, $invocant_count); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2180 | \$check ||= do{ my \$tmp = q($builder)->_build_method_signature_check(q($class), q($class\::$name), \$signature_style, \$signature, \\\@invocants); ref(\$tmp) eq q(HASH) ? \$tmp->{closure} : \$tmp }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2181 | \@_ = (\@invocants, \@curry, \&\$check); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2182 | goto \$coderef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2183 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2184 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2185 | 2 | ▶ | $wrapped or die("YIKES: $@"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2188 | 8 | ▶ | sub modify_method_moo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
modify_method_moo: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2189 | 8 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2190 | 8 | my ($class, $modifier, $method_names, $coderef) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2191 | 8 | my $helper = $builder->_get_moo_helper($class, $modifier); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2192 | 8 | $helper->(@$method_names, $coderef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2195 | 6 | ▶ | sub modify_method_moose { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
modify_method_moose: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2196 | 6 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2197 | 6 | my ($class, $modifier, $method_names, $coderef) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2198 | 6 | my $m = "add_$modifier\_method_modifier"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2199 | 6 | require Moose::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2200 | 6 | ▶ | my $meta = Moose::Util::find_meta($class) || $class->meta; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
Moose::Util::find_meta($class) || $class->meta
MC/DC0%0/2
Moose::Util::find_meta($class) || $class->meta
Moose::Util::find_meta($class)
$class->meta
Truth table33%1/3
A || B
A= Moose::Util::find_meta($class)B= $class->meta
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2201 | 6 | for my $method_name (@$method_names) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2202 | 8 | $meta->$m($method_name, $coderef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2206 | 6 | ▶ | sub modify_method_mouse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
modify_method_mouse: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2207 | 6 | my $builder = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2208 | 6 | my ($class, $modifier, $method_names, $coderef) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2209 | 6 | my $m = "add_$modifier\_method_modifier"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2210 | 6 | require Mouse::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2211 | 6 | ▶ | my $meta = (Mouse::Util::find_meta($class) or $class->meta); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
Mouse::Util::find_meta($class) || $class->meta
MC/DC0%0/2
Mouse::Util::find_meta($class) || $class->meta
Mouse::Util::find_meta($class)
$class->meta
Truth table33%1/3
A || B
A= Mouse::Util::find_meta($class)B= $class->meta
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2212 | 6 | for my $method_name (@$method_names) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2213 | 8 | $meta->$m($method_name, $coderef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2217 | 40 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2219 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||