| 1 | package Moose::Util::TypeConstraints::Builtins; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 398 | our $VERSION = '2.4001'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 398 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 398 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 398 | ▶ | use Class::Load qw( is_class_loaded ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 398 | ▶ | use List::Util 1.33 (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 398 | ▶ | use Scalar::Util qw( blessed ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 398 | ▶ | sub type { goto &Moose::Util::TypeConstraints::type } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 6368 | ▶ | sub subtype { goto &Moose::Util::TypeConstraints::subtype } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subtype: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 6368 | ▶ | sub as { goto &Moose::Util::TypeConstraints::as } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 6368 | ▶ | sub where (&) { goto &Moose::Util::TypeConstraints::where } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
where: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 6766 | ▶ | sub inline_as (&) { goto &Moose::Util::TypeConstraints::inline_as } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inline_as: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 398 | ▶ | sub define_builtins { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
define_builtins: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 398 | my $registry = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | type 'Any' # meta-type including all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1778 | ▶ | => where {1} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 398 | ▶ | => inline_as { '1' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | subtype 'Item' # base type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | => as 'Any' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | => inline_as { '1' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | subtype 'Undef' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | => as 'Item' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 25 | ▶ | => where { !defined($_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 413 | ▶ | => inline_as { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 413 | '!defined(' . $_[1] . ')' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 398 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | subtype 'Defined' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | => as 'Item' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 1623 | ▶ | => where { defined($_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 4101 | ▶ | => inline_as { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 4101 | 'defined(' . $_[1] . ')' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 398 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | subtype 'Bool' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | => as 'Item' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 55 | ▶ | => where { !defined($_) || $_ eq "" || "$_" eq '1' || "$_" eq '0' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
Branch: 1 branch
Condition100%6/6
not defined $_ or $_ eq "" or "$_" eq 1
not defined $_ or $_ eq ""
MC/DC100%3/3
not defined $_ or $_ eq "" or "$_" eq 1
not defined $_
$_ eq ""
"$_" eq 1
Truth table100%4/4
not(A) or B or C
A= not defined $_B= $_ eq ""C= "$_" eq 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 509 | ▶ | => inline_as { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 509 | '(' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | . '!defined(' . $_[1] . ') ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | . '|| ' . $_[1] . ' eq "" ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | . '|| (' . $_[1] . '."") eq "1" ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | . '|| (' . $_[1] . '."") eq "0"' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | . ')' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 398 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | subtype 'Value' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | => as 'Defined' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 651 | ▶ | => where { !ref($_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 2887 | ▶ | => inline_as { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 2887 | $_[0]->parent()->_inline_check($_[1]) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | . ' && !ref(' . $_[1] . ')' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 398 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | subtype 'Ref' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | => as 'Defined' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 927 | ▶ | => where { ref($_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # no need to call parent - ref also checks for definedness | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 398 | ▶ | => inline_as { 'ref(' . $_[1] . ')' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | subtype 'Str' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | => as 'Value' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 535 | ▶ | => where { ref(\$_) eq 'SCALAR' || ref(\(my $val = $_)) eq 'SCALAR' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 1270 | ▶ | => inline_as { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 1270 | $_[0]->parent()->_inline_check($_[1]) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | . ' && (' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | . 'ref(\\' . $_[1] . ') eq "SCALAR"' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | . ' || ref(\\(my $val = ' . $_[1] . ')) eq "SCALAR"' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | . ')' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 398 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 398 | my $value_type = Moose::Util::TypeConstraints::find_type_constraint('Value'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | subtype 'Num' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | => as 'Str' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 205 | ▶ | => where { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 205 | my $val = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 205 | ▶ | ($val =~ /\A[+-]?[0-9]+\z/) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | ( $val =~ /\A(?:[+-]?) # matches optional +- in the beginning | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | (?=[0-9]|\.[0-9]) # matches previous +- only if there is something like 3 or .3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | [0-9]* # matches 0-9 zero or more times | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | (?:\.[0-9]+)? # matches optional .89 or nothing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | (?:[Ee](?:[+-]?[0-9]+))? # matches E1 or e1 or e-1 or e+1 etc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | \z/x ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 423 | ▶ | => inline_as { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # the long Str tests are redundant here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | #storing $_[1] in a temporary value, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | #so that $_[1] won't get converted to a string for regex match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | #see t/attributes/numeric_defaults.t for more details | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 423 | 'my $val = '.$_[1].';'. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | $value_type->_inline_check('$val') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | .' && ( $val =~ /\A[+-]?[0-9]+\z/ || ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | . '$val =~ /\A(?:[+-]?) # matches optional +- in the beginning | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | (?=[0-9]|\.[0-9]) # matches previous +- only if there is something like 3 or .3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | [0-9]* # matches 0-9 zero or more times | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | (?:\.[0-9]+)? # matches optional .89 or nothing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | (?:[Ee](?:[+-]?[0-9]+))? # matches E1 or e1 or e-1 or e+1 etc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | \z/x ); ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 398 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | subtype 'Int' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | => as 'Num' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 184 | ▶ | => where { (my $val = $_) =~ /\A-?[0-9]+\z/ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 785 | ▶ | => inline_as { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 785 | $value_type->_inline_check($_[1]) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | . ' && (my $val = ' . $_[1] . ') =~ /\A-?[0-9]+\z/' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 398 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | subtype 'CodeRef' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | => as 'Ref' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 12 | ▶ | => where { ref($_) eq 'CODE' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 398 | ▶ | => inline_as { 'ref(' . $_[1] . ') eq "CODE"' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | subtype 'RegexpRef' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | => as 'Ref' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | => where( \&_RegexpRef ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 407 | ▶ | => inline_as { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 407 | 'Moose::Util::TypeConstraints::Builtins::_RegexpRef(' . $_[1] . ')' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 398 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | subtype 'GlobRef' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | => as 'Ref' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 12 | ▶ | => where { ref($_) eq 'GLOB' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 398 | ▶ | => inline_as { 'ref(' . $_[1] . ') eq "GLOB"' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | # NOTE: scalar filehandles are GLOB refs, but a GLOB ref is not always a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | # filehandle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | subtype 'FileHandle' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | => as 'Ref' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 12 | ▶ | => where { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 12 | ▶ | (ref($_) eq "GLOB" && Scalar::Util::openhandle($_)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
ref $_ eq 'GLOB' && &Scalar::Util::openhandle($_) || builtin::blessed($_) && $_->isa('IO::Handle')
ref $_ eq "GLOB" and &Scalar::Util::openhandle($_)
builtin::blessed($_) and $_->isa("IO::Handle")
MC/DC100%4/4
ref $_ eq 'GLOB' && &Scalar::Util::openhandle($_) || builtin::blessed($_) && $_->isa('IO::Handle')
ref $_ eq "GLOB"
&Scalar::Util::openhandle($_)
builtin::blessed($_)
$_->isa("IO::Handle")
Truth table71%5/7
A and B || C and D
A= ref $_ eq "GLOB"B= &Scalar::Util::openhandle($_)C= builtin::blessed($_)D= $_->isa("IO::Handle")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | || (blessed($_) && $_->isa("IO::Handle")); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 407 | ▶ | => inline_as { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 407 | '(ref(' . $_[1] . ') eq "GLOB" ' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | . '&& Scalar::Util::openhandle(' . $_[1] . ')) ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | . '|| (Scalar::Util::blessed(' . $_[1] . ') ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | . '&& ' . $_[1] . '->isa("IO::Handle"))' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 398 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | subtype 'Object' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | => as 'Ref' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 121 | ▶ | => where { blessed($_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 398 | ▶ | => inline_as { 'Scalar::Util::blessed(' . $_[1] . ')' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | subtype 'ClassName' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | => as 'Str' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 28 | ▶ | => where { is_class_loaded($_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # the long Str tests are redundant here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 398 | ▶ | => inline_as { 'Class::Load::is_class_loaded(' . $_[1] . ')' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | subtype 'RoleName' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | => as 'ClassName' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 3 | ▶ | => where { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 3 | ▶ | (Class::MOP::class_of($_) || return)->isa('Moose::Meta::Role'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
Class::MOP::class_of($_) || (return)
MC/DC100%1/1
Class::MOP::class_of($_) || (return)
Class::MOP::class_of($_)
Truth table100%2/2
A
A= Class::MOP::class_of($_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 408 | ▶ | => inline_as { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 408 | $_[0]->parent()->_inline_check($_[1]) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | . ' && do {' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | . 'my $meta = Class::MOP::class_of(' . $_[1] . ');' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | . '$meta && $meta->isa("Moose::Meta::Role");' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | . '}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 398 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | $registry->add_type_constraint( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | Moose::Meta::TypeConstraint::Parameterizable->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | name => 'ScalarRef', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | package_defined_in => __PACKAGE__, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | parent => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | Moose::Util::TypeConstraints::find_type_constraint('Ref'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 12 | ▶ | constraint => sub { ref($_) eq 'SCALAR' || ref($_) eq 'REF' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 1 | ▶ | constraint_generator => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | my $type_parameter = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | my $check = $type_parameter->_compiled_type_constraint; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | return $check->( ${$_} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 407 | ▶ | inlined => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 407 | 'ref(' . $_[1] . ') eq "SCALAR" ' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | . '|| ref(' . $_[1] . ') eq "REF"' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 2 | ▶ | inline_generator => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 2 | my $type_parameter = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 2 | my $val = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 2 | '(ref(' . $val . ') eq "SCALAR" || ref(' . $val . ') eq "REF") ' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | . '&& ' . $type_parameter->_inline_check('${(' . $val . ')}') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 398 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | $registry->add_type_constraint( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | Moose::Meta::TypeConstraint::Parameterizable->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | name => 'ArrayRef', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | package_defined_in => __PACKAGE__, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | parent => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | Moose::Util::TypeConstraints::find_type_constraint('Ref'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 448 | ▶ | constraint => sub { ref($_) eq 'ARRAY' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 108 | ▶ | constraint_generator => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 108 | my $type_parameter = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 108 | my $check = $type_parameter->_compiled_type_constraint; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 36 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 36 | foreach my $x (@$_) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 89 | ▶ | ( $check->($x) ) || return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 28 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 108 | }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 492 | ▶ | inlined => sub { 'ref(' . $_[1] . ') eq "ARRAY"' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 221 | ▶ | inline_generator => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 221 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 221 | my $type_parameter = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 221 | my $val = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 221 | 'do {' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | . 'my $check = ' . $val . ';' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | . 'ref($check) eq "ARRAY" ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | . '&& &List::Util::all(' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | . 'sub { ' . $type_parameter->_inline_check('$_') . ' }, ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | . '@{$check}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | . ')' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | . '}'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 398 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | $registry->add_type_constraint( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | Moose::Meta::TypeConstraint::Parameterizable->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | name => 'HashRef', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | package_defined_in => __PACKAGE__, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | parent => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | Moose::Util::TypeConstraints::find_type_constraint('Ref'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 141 | ▶ | constraint => sub { ref($_) eq 'HASH' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 20 | ▶ | constraint_generator => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 20 | my $type_parameter = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 20 | my $check = $type_parameter->_compiled_type_constraint; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 115 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 115 | foreach my $x ( values %$_ ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 178 | ▶ | ( $check->($x) ) || return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 95 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 20 | }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 569 | ▶ | inlined => sub { 'ref(' . $_[1] . ') eq "HASH"' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 85 | ▶ | inline_generator => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 85 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 85 | my $type_parameter = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 85 | my $val = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 85 | 'do {' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | . 'my $check = ' . $val . ';' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | . 'ref($check) eq "HASH" ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | . '&& &List::Util::all(' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | . 'sub { ' . $type_parameter->_inline_check('$_') . ' }, ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | . 'values %{$check}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | . ')' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | . '}'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 398 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | $registry->add_type_constraint( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | Moose::Meta::TypeConstraint::Parameterizable->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | name => 'Maybe', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | package_defined_in => __PACKAGE__, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | parent => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | Moose::Util::TypeConstraints::find_type_constraint('Item'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 25 | ▶ | constraint => sub {1}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 13 | ▶ | constraint_generator => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=2.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 13 | my $type_parameter = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 13 | my $check = $type_parameter->_compiled_type_constraint; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | return 1 if not( defined($_) ) || $check->($_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $_ or &$check($_)
MC/DC0%0/2
not defined $_ or &$check($_)
not defined $_
&$check($_)
Truth table0%0/3
not(A) or B
A= not defined $_B= &$check($_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 13 | }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 407 | ▶ | inlined => sub {'1'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 28 | ▶ | inline_generator => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 28 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 28 | my $type_parameter = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 28 | my $val = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 28 | '!defined(' . $val . ') ' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | . '|| (' . $type_parameter->_inline_check($val) . ')' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 398 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 398 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||