| 1 | package TUI::toolkit::Types; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Type constraints that are based heavily on Type::Nano | ||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | 136 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 136 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 136 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 136 | our $VERSION = '0.07'; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 136 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 136 | ▶ | use Scalar::Util qw( | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | blessed | ||||||||||||||||||||||||||||||||||||||||||
| 13 | openhandle | ||||||||||||||||||||||||||||||||||||||||||
| 14 | looks_like_number | ||||||||||||||||||||||||||||||||||||||||||
| 15 | reftype | ||||||||||||||||||||||||||||||||||||||||||
| 16 | 136 | ); | |||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 19 | # Export type constraints | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 136 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 136 | our @EXPORT_OK = qw( | |||||||||||||||||||||||||||||||||||||||||
| 25 | Maybe | ||||||||||||||||||||||||||||||||||||||||||
| 26 | InstanceOf | ||||||||||||||||||||||||||||||||||||||||||
| 27 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 136 | our %EXPORT_TAGS = ( | |||||||||||||||||||||||||||||||||||||||||
| 30 | # Standard Types | ||||||||||||||||||||||||||||||||||||||||||
| 31 | Any => [qw( Any is_Any )], | ||||||||||||||||||||||||||||||||||||||||||
| 32 | Item => [qw( Item is_Item )], | ||||||||||||||||||||||||||||||||||||||||||
| 33 | Undef => [qw( Undef is_Undef )], | ||||||||||||||||||||||||||||||||||||||||||
| 34 | Defined => [qw( Defined is_Defined )], | ||||||||||||||||||||||||||||||||||||||||||
| 35 | Value => [qw( Value is_Value )], | ||||||||||||||||||||||||||||||||||||||||||
| 36 | Bool => [qw( Bool is_Bool )], | ||||||||||||||||||||||||||||||||||||||||||
| 37 | Str => [qw( Str is_Str )], | ||||||||||||||||||||||||||||||||||||||||||
| 38 | Num => [qw( Num is_Num )], | ||||||||||||||||||||||||||||||||||||||||||
| 39 | Int => [qw( Int is_Int )], | ||||||||||||||||||||||||||||||||||||||||||
| 40 | Object => [qw( Object is_Object )], | ||||||||||||||||||||||||||||||||||||||||||
| 41 | Ref => [qw( Ref is_Ref )], | ||||||||||||||||||||||||||||||||||||||||||
| 42 | ScalarRef => [qw( ScalarRef is_ScalarRef )], | ||||||||||||||||||||||||||||||||||||||||||
| 43 | ArrayRef => [qw( ArrayRef is_ArrayRef )], | ||||||||||||||||||||||||||||||||||||||||||
| 44 | HashRef => [qw( HashRef is_HashRef )], | ||||||||||||||||||||||||||||||||||||||||||
| 45 | CodeRef => [qw( CodeRef is_CodeRef )], | ||||||||||||||||||||||||||||||||||||||||||
| 46 | GlobRef => [qw( GlobRef is_GlobRef )], | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | # Special Types | ||||||||||||||||||||||||||||||||||||||||||
| 49 | ClassName => [qw( ClassName is_ClassName )], | ||||||||||||||||||||||||||||||||||||||||||
| 50 | PositiveInt => [qw( PositiveInt is_PositiveInt )], | ||||||||||||||||||||||||||||||||||||||||||
| 51 | PositiveOrZeroInt => [qw( PositiveOrZeroInt is_PositiveOrZeroInt )], | ||||||||||||||||||||||||||||||||||||||||||
| 52 | FileHandle => [qw( FileHandle is_FileHandle )], | ||||||||||||||||||||||||||||||||||||||||||
| 53 | ArrayLike => [qw( ArrayLike is_ArrayLike )], | ||||||||||||||||||||||||||||||||||||||||||
| 54 | HashLike => [qw( HashLike is_HashLike )], | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | # Additional groups | ||||||||||||||||||||||||||||||||||||||||||
| 57 | types => [qw( | ||||||||||||||||||||||||||||||||||||||||||
| 58 | Any | ||||||||||||||||||||||||||||||||||||||||||
| 59 | Item | ||||||||||||||||||||||||||||||||||||||||||
| 60 | Undef | ||||||||||||||||||||||||||||||||||||||||||
| 61 | Defined | ||||||||||||||||||||||||||||||||||||||||||
| 62 | Value | ||||||||||||||||||||||||||||||||||||||||||
| 63 | Bool | ||||||||||||||||||||||||||||||||||||||||||
| 64 | Str | ||||||||||||||||||||||||||||||||||||||||||
| 65 | ClassName | ||||||||||||||||||||||||||||||||||||||||||
| 66 | Num | ||||||||||||||||||||||||||||||||||||||||||
| 67 | Int | ||||||||||||||||||||||||||||||||||||||||||
| 68 | PositiveInt | ||||||||||||||||||||||||||||||||||||||||||
| 69 | PositiveOrZeroInt | ||||||||||||||||||||||||||||||||||||||||||
| 70 | Object | ||||||||||||||||||||||||||||||||||||||||||
| 71 | Ref | ||||||||||||||||||||||||||||||||||||||||||
| 72 | ScalarRef | ||||||||||||||||||||||||||||||||||||||||||
| 73 | ArrayRef | ||||||||||||||||||||||||||||||||||||||||||
| 74 | HashRef | ||||||||||||||||||||||||||||||||||||||||||
| 75 | CodeRef | ||||||||||||||||||||||||||||||||||||||||||
| 76 | GlobRef | ||||||||||||||||||||||||||||||||||||||||||
| 77 | FileHandle | ||||||||||||||||||||||||||||||||||||||||||
| 78 | ArrayLike | ||||||||||||||||||||||||||||||||||||||||||
| 79 | HashLike | ||||||||||||||||||||||||||||||||||||||||||
| 80 | )], | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | is => [qw( | ||||||||||||||||||||||||||||||||||||||||||
| 83 | is_Any | ||||||||||||||||||||||||||||||||||||||||||
| 84 | is_Item | ||||||||||||||||||||||||||||||||||||||||||
| 85 | is_Undef | ||||||||||||||||||||||||||||||||||||||||||
| 86 | is_Defined | ||||||||||||||||||||||||||||||||||||||||||
| 87 | is_Value | ||||||||||||||||||||||||||||||||||||||||||
| 88 | is_Bool | ||||||||||||||||||||||||||||||||||||||||||
| 89 | is_Str | ||||||||||||||||||||||||||||||||||||||||||
| 90 | is_ClassName | ||||||||||||||||||||||||||||||||||||||||||
| 91 | is_Num | ||||||||||||||||||||||||||||||||||||||||||
| 92 | is_Int | ||||||||||||||||||||||||||||||||||||||||||
| 93 | is_PositiveInt | ||||||||||||||||||||||||||||||||||||||||||
| 94 | is_PositiveOrZeroInt | ||||||||||||||||||||||||||||||||||||||||||
| 95 | is_Object | ||||||||||||||||||||||||||||||||||||||||||
| 96 | is_Ref | ||||||||||||||||||||||||||||||||||||||||||
| 97 | is_ScalarRef | ||||||||||||||||||||||||||||||||||||||||||
| 98 | is_ArrayRef | ||||||||||||||||||||||||||||||||||||||||||
| 99 | is_HashRef | ||||||||||||||||||||||||||||||||||||||||||
| 100 | is_CodeRef | ||||||||||||||||||||||||||||||||||||||||||
| 101 | is_GlobRef | ||||||||||||||||||||||||||||||||||||||||||
| 102 | is_FileHandle | ||||||||||||||||||||||||||||||||||||||||||
| 103 | is_ArrayLike | ||||||||||||||||||||||||||||||||||||||||||
| 104 | is_HashLike | ||||||||||||||||||||||||||||||||||||||||||
| 105 | )], | ||||||||||||||||||||||||||||||||||||||||||
| 106 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | # add all the other %EXPORT_TAGS ":class" tags to the ":all" class and | ||||||||||||||||||||||||||||||||||||||||||
| 109 | # @EXPORT_OK, deleting duplicates | ||||||||||||||||||||||||||||||||||||||||||
| 110 | { | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 136 | my %seen; | |||||||||||||||||||||||||||||||||||||||||
| 112 | push | ||||||||||||||||||||||||||||||||||||||||||
| 113 | @EXPORT_OK, | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 11968 | grep {!$seen{$_}++} @{$EXPORT_TAGS{$_}} | |||||||||||||||||||||||||||||||||||||||||
| 115 | 136 | foreach keys %EXPORT_TAGS; | |||||||||||||||||||||||||||||||||||||||||
| 116 | push | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 136 | @{$EXPORT_TAGS{all}}, | |||||||||||||||||||||||||||||||||||||||||
| 118 | @EXPORT_OK; | ||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 122 | # Built-in Type::API-compatible type object | ||||||||||||||||||||||||||||||||||||||||||
| 123 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 124 | { | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 136 | package # hides from CPAN | |||||||||||||||||||||||||||||||||||||||||
| 126 | TUI::Type::Object; | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 136 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 136 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | 136 | ▶ | use B (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | 136 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | 136 | my %roles = ( | |||||||||||||||||||||||||||||||||||||||||
| 135 | 'Type::API::Constraint' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 136 | 'Type::API::Constraint::Constructor' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 'Type::API::Constraint::Inlinable' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 138 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | 512 | ▶ | sub DOES { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DOES: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | 512 | my ( $proto, $role ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 142 | 512 | ▶ | return !!1 if $roles{$role}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 407 | return $proto->SUPER::DOES( $role ); | |||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 1149 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | 1149 | my ( $class, %spec ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 148 | 1149 | ▶ | die "missing name" unless exists $spec{name}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 1149 | ▶ | die "missing constraint" unless exists $spec{constraint}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | 1149 | return bless \%spec => $class; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 2902 | ▶ | sub check { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 2902 | my ( $param, $value ) = ( shift, @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 155 | 2902 | ▶ | if ( $param->{parent} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 2267 | ▶ | return !!0 unless $param->{parent}->check( $value ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 2809 | local $_ = $value; | |||||||||||||||||||||||||||||||||||||||||
| 159 | 2809 | return $param->{constraint}->( $value ); | |||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 89 | ▶ | sub get_message { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_message: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 89 | my ( $param, $value ) = ( shift, @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 164 | 89 | ▶ | $value = ref( $value ) ? ( "Reference " . $value ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | : defined( $value ) ? ( "Value " . B::perlstring( $value ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 166 | : "Undef"; | ||||||||||||||||||||||||||||||||||||||||||
| 167 | 89 | return $value . ' did not pass type constraint "' . $param->{name} . '"'; | |||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 496 | ▶ | sub can_be_inlined { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_be_inlined: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 496 | my $param = shift; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 496 | return ref( $param->{inlined} ) eq 'CODE'; | |||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 1080 | ▶ | sub inline_check { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inline_check: called CC=5 SCAR=18.1
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 1080 | my ( $param, $name ) = ( shift, @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 177 | 1080 | ▶ | return unless defined( $name ) && !ref( $name ) && length( $name ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $name and not ref $name and length $name
defined $name and not ref $name
MC/DC0%0/3
defined $name and not ref $name and length $name
defined $name
not ref $name
length $name
Truth table25%1/4
A and not(B) and C
A= defined $nameB= not ref $nameC= length $name
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 1080 | ▶ | return unless ref( $param->{inlined} ) eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 1073 | return $param->{inlined}->( $param, $name ); | |||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | 472 | ▶ | sub name { shift->{name} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | 26 | ▶ | sub parent { shift->{parent} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parent: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | sub constraint { shift->{constraint} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
constraint: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | use overload | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 4019 | ▶ | 'bool' => sub { 1 }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | '""' => sub { shift->{name} }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 161 | ▶ | '&{}' => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 161 | my $param = shift; | |||||||||||||||||||||||||||||||||||||||||
| 191 | 135 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 135 | my ( $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 135 | ▶ | $param->check( $value ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | or Carp::croak( $param->get_message( $value ) ); | ||||||||||||||||||||||||||||||||||||||||||
| 195 | 161 | }; | |||||||||||||||||||||||||||||||||||||||||
| 196 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 136 | fallback => 1; | |||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 202 | # Primitive constraints | ||||||||||||||||||||||||||||||||||||||||||
| 203 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 836 | ▶ | sub is_Any ($) { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_Any: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 631 | ▶ | sub is_Item ($) { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_Item: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | 24 | ▶ | sub is_Undef ($) { !defined($_[0]) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_Undef: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 402 | ▶ | sub is_Defined ($) { defined($_[0]) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_Defined: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 207 | ▶ | sub is_Value ($) { defined($_[0]) && !ref($_[0]) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_Value: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 515 | ▶ | sub is_Str ($) { defined($_[0]) && ref(\$_[0]) eq 'SCALAR' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_Str: called CC=2 SCAR=7.6
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 32 | ▶ | sub is_Bool ($) { !defined($_[0]) || $_[0] =~ /\A[01]?\z/ } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_Bool: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 59 | ▶ | sub is_Num ($) { looks_like_number($_[0]) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_Num: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | 111 | ▶ | sub is_Int ($) { defined($_[0]) && $_[0] =~ /\A-?\d+\z/ } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_Int: called CC=2 SCAR=7.6
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | 20 | ▶ | sub is_PositiveInt ($) { defined($_[0]) && $_[0] =~ /\A[1-9]\d*\z/ } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_PositiveInt: called CC=2 SCAR=7.6
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 73740 | ▶ | sub is_PositiveOrZeroInt ($) { defined($_[0]) && $_[0] =~ /\A\d+\z/ } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_PositiveOrZeroInt: called CC=2 SCAR=7.6
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 25126 | ▶ | sub is_Object ($) { blessed($_[0]) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_Object: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 219 | # Ref constraints | ||||||||||||||||||||||||||||||||||||||||||
| 220 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 199 | ▶ | sub is_Ref ($) { !!ref($_[0]) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_Ref: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 22 | ▶ | sub is_ScalarRef ($) { ref($_[0]) eq 'SCALAR' || ref($_[0]) eq 'REF' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_ScalarRef: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 93 | ▶ | sub is_ArrayRef ($) { ref($_[0]) eq 'ARRAY' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_ArrayRef: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | 37 | ▶ | sub is_HashRef ($) { ref($_[0]) eq 'HASH' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_HashRef: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 74 | ▶ | sub is_CodeRef ($) { ref($_[0]) eq 'CODE' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_CodeRef: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | 24 | ▶ | sub is_GlobRef ($) { ref($_[0]) eq 'GLOB' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_GlobRef: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 230 | # Special constraints | ||||||||||||||||||||||||||||||||||||||||||
| 231 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 10 | ▶ | sub is_ClassName ($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_ClassName: called CC=10 SCAR=24.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 10 | my ( $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 235 | # is_Str and not empty (or zero) | ||||||||||||||||||||||||||||||||||||||||||
| 236 | 10 | ▶ | return !!0 unless $value && ref( \$value ) eq 'SCALAR'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$value and ref \$value eq "SCALAR"
MC/DC50%1/2
$value and ref \$value eq "SCALAR"
$value
ref \$value eq "SCALAR"
Truth table66%2/3
A and B
A= $valueB= ref \$value eq "SCALAR"
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | # We manually check the stash | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 136 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 8 | my $stash = \%{"$value\::"}; | |||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | # The Package must have @ISA .. | ||||||||||||||||||||||||||||||||||||||||||
| 243 | return !!1 if exists $stash->{'ISA'} | ||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | && *{ $stash->{'ISA'} }{ARRAY} | |||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | && @{"$value\::ISA"}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
exists $stash->{"ISA"} and *{$stash->{"ISA"};}{"ARRAY"} and @{"${value}::ISA";}
exists $stash->{"ISA"} and *{$stash->{"ISA"};}{"ARRAY"}
MC/DC0%0/2
exists $stash->{"ISA"} and *{$stash->{"ISA"};}{"ARRAY"} and @{"${value}::ISA";}
exists $stash->{"ISA"}
@{"${value}::ISA";}
Truth table33%1/3
A and B
A= exists $stash->{"ISA"}B= @{"${value}::ISA";}
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | # .. or $VERSION .. | ||||||||||||||||||||||||||||||||||||||||||
| 248 | 8 | ▶ | return !!1 if exists $stash->{'VERSION'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | # .. or must define at least one sub | ||||||||||||||||||||||||||||||||||||||||||
| 251 | 4 | foreach my $symbol ( values %$stash ) { | |||||||||||||||||||||||||||||||||||||||||
| 252 | return !!1 | ||||||||||||||||||||||||||||||||||||||||||
| 253 | if is_GlobRef( \$symbol ) | ||||||||||||||||||||||||||||||||||||||||||
| 254 | 2 | ? *{$symbol}{CODE} | |||||||||||||||||||||||||||||||||||||||||
| 255 | 2 | ▶ | : ref $symbol; # const or sub ref | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | 2 | return !!0; | |||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 26 | ▶ | sub is_FileHandle ($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_FileHandle: called CC=5 SCAR=16.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 26 | ▶ | return !!1 if ref($_[0]) && openhandle($_[0]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $_[0] and &openhandle($_[0])
MC/DC100%2/2
ref $_[0] and &openhandle($_[0])
ref $_[0]
&openhandle($_[0])
Truth table100%3/3
A and B
A= ref $_[0]B= &openhandle($_[0])
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | 8 | ▶ | return !!1 if blessed($_[0]) && $_[0]->isa( "IO::Handle" ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($_[0]) and $_[0]->isa("IO::Handle")
MC/DC0%0/2
builtin::blessed($_[0]) and $_[0]->isa("IO::Handle")
builtin::blessed($_[0])
$_[0]->isa("IO::Handle")
Truth table33%1/3
A and B
A= builtin::blessed($_[0])B= $_[0]->isa("IO::Handle")
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | 8 | return !!0; | |||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | 113 | ▶ | sub is_ArrayLike ($) { ref($_[0]) && reftype($_[0]) eq 'ARRAY' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_ArrayLike: called CC=2 SCAR=7.6
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | sub is_HashLike ($) { ref($_[0]) && reftype($_[0]) eq 'HASH' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_HashLike: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 271 | # Type constructors (non-parametric) | ||||||||||||||||||||||||||||||||||||||||||
| 272 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 136 | our %TYPES; | |||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 143 | ▶ | sub Any () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Any: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | $TYPES{Any} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 278 | name => 'Any', | ||||||||||||||||||||||||||||||||||||||||||
| 279 | constraint => \&is_Any, | ||||||||||||||||||||||||||||||||||||||||||
| 280 | 11 | ▶ | inlined => sub { "1" }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 143 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"Any"} ||= "TUI::Type::Object"->new("name", "Any", "constraint", \&TUI::toolkit::Types::is_Any, "inlined", sub {
1;
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"Any"} ||= "TUI::Type::Object"->new("name", "Any", "constraint", \&TUI::toolkit::Types::is_Any, "inlined", sub {
1;
}
)
$TUI::toolkit::Types::TYPES{"Any"}
"TUI::Type::Object"->new("name", "Any", "constraint", \&TUI::toolkit::Types::is_Any, "inlined", sub {
1;
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"Any"}B= "TUI::Type::Object"->new("name", "Any", "constraint", \&TUI::toolkit::Types::is_Any, "inlined", sub {
1;
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | 169 | ▶ | sub Item () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Item: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | $TYPES{Item} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 286 | name => 'Item', | ||||||||||||||||||||||||||||||||||||||||||
| 287 | parent => Any, | ||||||||||||||||||||||||||||||||||||||||||
| 288 | constraint => \&is_Item, | ||||||||||||||||||||||||||||||||||||||||||
| 289 | 15 | ▶ | inlined => sub { "1" }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | 169 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"Item"} ||= "TUI::Type::Object"->new("name", "Item", "parent", &Any(), "constraint", \&TUI::toolkit::Types::is_Item, "inlined", sub {
1;
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"Item"} ||= "TUI::Type::Object"->new("name", "Item", "parent", &Any(), "constraint", \&TUI::toolkit::Types::is_Item, "inlined", sub {
1;
}
)
$TUI::toolkit::Types::TYPES{"Item"}
"TUI::Type::Object"->new("name", "Item", "parent", &Any(), "constraint", \&TUI::toolkit::Types::is_Item, "inlined", sub {
1;
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"Item"}B= "TUI::Type::Object"->new("name", "Item", "parent", &Any(), "constraint", \&TUI::toolkit::Types::is_Item, "inlined", sub {
1;
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | 2 | ▶ | sub Undef () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Undef: called CC=2 SCAR=8.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | $TYPES{Undef} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 295 | name => 'Undef', | ||||||||||||||||||||||||||||||||||||||||||
| 296 | parent => Item, | ||||||||||||||||||||||||||||||||||||||||||
| 297 | constraint => \&is_Undef, | ||||||||||||||||||||||||||||||||||||||||||
| 298 | 1 | ▶ | inlined => sub { "!defined($_[1])" }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 2 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$TUI::toolkit::Types::TYPES{"Undef"} ||= "TUI::Type::Object"->new("name", "Undef", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Undef, "inlined", sub {
"!defined($_[1])";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"Undef"} ||= "TUI::Type::Object"->new("name", "Undef", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Undef, "inlined", sub {
"!defined($_[1])";
}
)
$TUI::toolkit::Types::TYPES{"Undef"}
"TUI::Type::Object"->new("name", "Undef", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Undef, "inlined", sub {
"!defined($_[1])";
}
)
Truth table33%1/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"Undef"}B= "TUI::Type::Object"->new("name", "Undef", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Undef, "inlined", sub {
"!defined($_[1])";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 444 | ▶ | sub Defined () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Defined: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | $TYPES{Defined} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 304 | name => 'Defined', | ||||||||||||||||||||||||||||||||||||||||||
| 305 | parent => Item, | ||||||||||||||||||||||||||||||||||||||||||
| 306 | constraint => \&is_Defined, | ||||||||||||||||||||||||||||||||||||||||||
| 307 | 193 | ▶ | inlined => sub { "defined($_[1])" }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 444 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"Defined"} ||= "TUI::Type::Object"->new("name", "Defined", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Defined, "inlined", sub {
"defined($_[1])";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"Defined"} ||= "TUI::Type::Object"->new("name", "Defined", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Defined, "inlined", sub {
"defined($_[1])";
}
)
$TUI::toolkit::Types::TYPES{"Defined"}
"TUI::Type::Object"->new("name", "Defined", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Defined, "inlined", sub {
"defined($_[1])";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"Defined"}B= "TUI::Type::Object"->new("name", "Defined", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Defined, "inlined", sub {
"defined($_[1])";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | 145 | ▶ | sub Value () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Value: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | $TYPES{Value} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 313 | name => 'Value', | ||||||||||||||||||||||||||||||||||||||||||
| 314 | parent => Defined, | ||||||||||||||||||||||||||||||||||||||||||
| 315 | constraint => \&is_Value, | ||||||||||||||||||||||||||||||||||||||||||
| 316 | 1 | ▶ | inlined => sub { "defined($_[1]) && !ref($_[1])" }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | 145 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"Value"} ||= "TUI::Type::Object"->new("name", "Value", "parent", &Defined(), "constraint", \&TUI::toolkit::Types::is_Value, "inlined", sub {
"defined($_[1]) && !ref($_[1])";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"Value"} ||= "TUI::Type::Object"->new("name", "Value", "parent", &Defined(), "constraint", \&TUI::toolkit::Types::is_Value, "inlined", sub {
"defined($_[1]) && !ref($_[1])";
}
)
$TUI::toolkit::Types::TYPES{"Value"}
"TUI::Type::Object"->new("name", "Value", "parent", &Defined(), "constraint", \&TUI::toolkit::Types::is_Value, "inlined", sub {
"defined($_[1]) && !ref($_[1])";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"Value"}B= "TUI::Type::Object"->new("name", "Value", "parent", &Defined(), "constraint", \&TUI::toolkit::Types::is_Value, "inlined", sub {
"defined($_[1]) && !ref($_[1])";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | 19 | ▶ | sub Bool () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Bool: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | $TYPES{Bool} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 322 | name => 'Bool', | ||||||||||||||||||||||||||||||||||||||||||
| 323 | parent => Item, | ||||||||||||||||||||||||||||||||||||||||||
| 324 | constraint => \&is_Bool, | ||||||||||||||||||||||||||||||||||||||||||
| 325 | 18 | ▶ | inlined => sub { "do { local \$_ = $_[1]; !defined || /\\A[01]?\\z/ }" }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | 19 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"Bool"} ||= "TUI::Type::Object"->new("name", "Bool", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Bool, "inlined", sub {
"do { local \$_ = $_[1]; !defined || /\\A[01]?\\z/ }";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"Bool"} ||= "TUI::Type::Object"->new("name", "Bool", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Bool, "inlined", sub {
"do { local \$_ = $_[1]; !defined || /\\A[01]?\\z/ }";
}
)
$TUI::toolkit::Types::TYPES{"Bool"}
"TUI::Type::Object"->new("name", "Bool", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Bool, "inlined", sub {
"do { local \$_ = $_[1]; !defined || /\\A[01]?\\z/ }";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"Bool"}B= "TUI::Type::Object"->new("name", "Bool", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Bool, "inlined", sub {
"do { local \$_ = $_[1]; !defined || /\\A[01]?\\z/ }";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 77 | ▶ | sub Str () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Str: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | $TYPES{Str} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 331 | name => 'Str', | ||||||||||||||||||||||||||||||||||||||||||
| 332 | parent => Value, | ||||||||||||||||||||||||||||||||||||||||||
| 333 | constraint => \&is_Str, | ||||||||||||||||||||||||||||||||||||||||||
| 334 | 48 | ▶ | inlined => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 335 | 48 | "do { local \$_ = $_[1]; defined && ref \\\$_ eq 'SCALAR' }" | |||||||||||||||||||||||||||||||||||||||||
| 336 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 77 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"Str"} ||= "TUI::Type::Object"->new("name", "Str", "parent", &Value(), "constraint", \&TUI::toolkit::Types::is_Str, "inlined", sub {
"do { local \$_ = $_[1]; defined && ref \\\$_ eq 'SCALAR' }";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"Str"} ||= "TUI::Type::Object"->new("name", "Str", "parent", &Value(), "constraint", \&TUI::toolkit::Types::is_Str, "inlined", sub {
"do { local \$_ = $_[1]; defined && ref \\\$_ eq 'SCALAR' }";
}
)
$TUI::toolkit::Types::TYPES{"Str"}
"TUI::Type::Object"->new("name", "Str", "parent", &Value(), "constraint", \&TUI::toolkit::Types::is_Str, "inlined", sub {
"do { local \$_ = $_[1]; defined && ref \\\$_ eq 'SCALAR' }";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"Str"}B= "TUI::Type::Object"->new("name", "Str", "parent", &Value(), "constraint", \&TUI::toolkit::Types::is_Str, "inlined", sub {
"do { local \$_ = $_[1]; defined && ref \\\$_ eq 'SCALAR' }";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | 3 | ▶ | sub ClassName () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ClassName: called CC=2 SCAR=9.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 341 | 3 | ▶ | $TYPES{ClassName} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$TUI::toolkit::Types::TYPES{"ClassName"} ||= "TUI::Type::Object"->new("name", "ClassName", "parent", &Str(), "constraint", \&TUI::toolkit::Types::is_ClassName)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"ClassName"} ||= "TUI::Type::Object"->new("name", "ClassName", "parent", &Str(), "constraint", \&TUI::toolkit::Types::is_ClassName)
$TUI::toolkit::Types::TYPES{"ClassName"}
"TUI::Type::Object"->new("name", "ClassName", "parent", &Str(), "constraint", \&TUI::toolkit::Types::is_ClassName)
Truth table33%1/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"ClassName"}B= "TUI::Type::Object"->new("name", "ClassName", "parent", &Str(), "constraint", \&TUI::toolkit::Types::is_ClassName)
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | name => 'ClassName', | ||||||||||||||||||||||||||||||||||||||||||
| 343 | parent => Str, | ||||||||||||||||||||||||||||||||||||||||||
| 344 | constraint => \&is_ClassName, | ||||||||||||||||||||||||||||||||||||||||||
| 345 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | 147 | ▶ | sub Num () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Num: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | $TYPES{Num} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 350 | name => 'Num', | ||||||||||||||||||||||||||||||||||||||||||
| 351 | parent => Value, | ||||||||||||||||||||||||||||||||||||||||||
| 352 | constraint => \&is_Num, | ||||||||||||||||||||||||||||||||||||||||||
| 353 | 17 | ▶ | inlined => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | 17 | "do { require Scalar::Util; Scalar::Util::looks_like_number($_[1]) }" | |||||||||||||||||||||||||||||||||||||||||
| 355 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 356 | 147 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"Num"} ||= "TUI::Type::Object"->new("name", "Num", "parent", &Value(), "constraint", \&TUI::toolkit::Types::is_Num, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::looks_like_number($_[1]) }";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"Num"} ||= "TUI::Type::Object"->new("name", "Num", "parent", &Value(), "constraint", \&TUI::toolkit::Types::is_Num, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::looks_like_number($_[1]) }";
}
)
$TUI::toolkit::Types::TYPES{"Num"}
"TUI::Type::Object"->new("name", "Num", "parent", &Value(), "constraint", \&TUI::toolkit::Types::is_Num, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::looks_like_number($_[1]) }";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"Num"}B= "TUI::Type::Object"->new("name", "Num", "parent", &Value(), "constraint", \&TUI::toolkit::Types::is_Num, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::looks_like_number($_[1]) }";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 318 | ▶ | sub Int () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Int: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | $TYPES{Int} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 361 | name => 'Int', | ||||||||||||||||||||||||||||||||||||||||||
| 362 | parent => Num, | ||||||||||||||||||||||||||||||||||||||||||
| 363 | constraint => \&is_Int, | ||||||||||||||||||||||||||||||||||||||||||
| 364 | 291 | ▶ | inlined => sub { "do { local \$_ = $_[1]; defined && /\\A-?\\d+\\z/ }" }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 365 | 318 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"Int"} ||= "TUI::Type::Object"->new("name", "Int", "parent", &Num(), "constraint", \&TUI::toolkit::Types::is_Int, "inlined", sub {
"do { local \$_ = $_[1]; defined && /\\A-?\\d+\\z/ }";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"Int"} ||= "TUI::Type::Object"->new("name", "Int", "parent", &Num(), "constraint", \&TUI::toolkit::Types::is_Int, "inlined", sub {
"do { local \$_ = $_[1]; defined && /\\A-?\\d+\\z/ }";
}
)
$TUI::toolkit::Types::TYPES{"Int"}
"TUI::Type::Object"->new("name", "Int", "parent", &Num(), "constraint", \&TUI::toolkit::Types::is_Int, "inlined", sub {
"do { local \$_ = $_[1]; defined && /\\A-?\\d+\\z/ }";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"Int"}B= "TUI::Type::Object"->new("name", "Int", "parent", &Num(), "constraint", \&TUI::toolkit::Types::is_Int, "inlined", sub {
"do { local \$_ = $_[1]; defined && /\\A-?\\d+\\z/ }";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | 2 | ▶ | sub PositiveInt () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PositiveInt: called CC=2 SCAR=8.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | $TYPES{PositiveInt} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 370 | name => 'PositiveInt', | ||||||||||||||||||||||||||||||||||||||||||
| 371 | parent => Int, | ||||||||||||||||||||||||||||||||||||||||||
| 372 | constraint => \&is_PositiveInt, | ||||||||||||||||||||||||||||||||||||||||||
| 373 | 1 | ▶ | inlined => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | 1 | "do { local \$_ = $_[1]; defined && /\\A[1-9]\\d*\\z/ }" | |||||||||||||||||||||||||||||||||||||||||
| 375 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 376 | 2 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$TUI::toolkit::Types::TYPES{"PositiveInt"} ||= "TUI::Type::Object"->new("name", "PositiveInt", "parent", &Int(), "constraint", \&TUI::toolkit::Types::is_PositiveInt, "inlined", sub {
"do { local \$_ = $_[1]; defined && /\\A[1-9]\\d*\\z/ }";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"PositiveInt"} ||= "TUI::Type::Object"->new("name", "PositiveInt", "parent", &Int(), "constraint", \&TUI::toolkit::Types::is_PositiveInt, "inlined", sub {
"do { local \$_ = $_[1]; defined && /\\A[1-9]\\d*\\z/ }";
}
)
$TUI::toolkit::Types::TYPES{"PositiveInt"}
"TUI::Type::Object"->new("name", "PositiveInt", "parent", &Int(), "constraint", \&TUI::toolkit::Types::is_PositiveInt, "inlined", sub {
"do { local \$_ = $_[1]; defined && /\\A[1-9]\\d*\\z/ }";
}
)
Truth table33%1/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"PositiveInt"}B= "TUI::Type::Object"->new("name", "PositiveInt", "parent", &Int(), "constraint", \&TUI::toolkit::Types::is_PositiveInt, "inlined", sub {
"do { local \$_ = $_[1]; defined && /\\A[1-9]\\d*\\z/ }";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||
| 379 | 28 | ▶ | sub PositiveOrZeroInt () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PositiveOrZeroInt: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 380 | $TYPES{PositiveOrZeroInt} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 381 | name => 'PositiveOrZeroInt', | ||||||||||||||||||||||||||||||||||||||||||
| 382 | parent => Int, | ||||||||||||||||||||||||||||||||||||||||||
| 383 | constraint => \&is_PositiveOrZeroInt, | ||||||||||||||||||||||||||||||||||||||||||
| 384 | 27 | ▶ | inlined => sub { "do { local \$_ = $_[1]; defined && /\\A\\d+\\z/ }" }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | 28 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"PositiveOrZeroInt"} ||= "TUI::Type::Object"->new("name", "PositiveOrZeroInt", "parent", &Int(), "constraint", \&TUI::toolkit::Types::is_PositiveOrZeroInt, "inlined", sub {
"do { local \$_ = $_[1]; defined && /\\A\\d+\\z/ }";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"PositiveOrZeroInt"} ||= "TUI::Type::Object"->new("name", "PositiveOrZeroInt", "parent", &Int(), "constraint", \&TUI::toolkit::Types::is_PositiveOrZeroInt, "inlined", sub {
"do { local \$_ = $_[1]; defined && /\\A\\d+\\z/ }";
}
)
$TUI::toolkit::Types::TYPES{"PositiveOrZeroInt"}
"TUI::Type::Object"->new("name", "PositiveOrZeroInt", "parent", &Int(), "constraint", \&TUI::toolkit::Types::is_PositiveOrZeroInt, "inlined", sub {
"do { local \$_ = $_[1]; defined && /\\A\\d+\\z/ }";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"PositiveOrZeroInt"}B= "TUI::Type::Object"->new("name", "PositiveOrZeroInt", "parent", &Int(), "constraint", \&TUI::toolkit::Types::is_PositiveOrZeroInt, "inlined", sub {
"do { local \$_ = $_[1]; defined && /\\A\\d+\\z/ }";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | 426 | ▶ | sub Object () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Object: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 389 | $TYPES{Object} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 390 | name => 'Object', | ||||||||||||||||||||||||||||||||||||||||||
| 391 | parent => Ref(), | ||||||||||||||||||||||||||||||||||||||||||
| 392 | constraint => \&is_Object, | ||||||||||||||||||||||||||||||||||||||||||
| 393 | 405 | ▶ | inlined => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | 405 | "do { require Scalar::Util; Scalar::Util::blessed($_[1]) }" | |||||||||||||||||||||||||||||||||||||||||
| 395 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 396 | 426 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"Object"} ||= "TUI::Type::Object"->new("name", "Object", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_Object, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::blessed($_[1]) }";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"Object"} ||= "TUI::Type::Object"->new("name", "Object", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_Object, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::blessed($_[1]) }";
}
)
$TUI::toolkit::Types::TYPES{"Object"}
"TUI::Type::Object"->new("name", "Object", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_Object, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::blessed($_[1]) }";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"Object"}B= "TUI::Type::Object"->new("name", "Object", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_Object, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::blessed($_[1]) }";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||
| 399 | 10 | ▶ | sub CodeRef () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CodeRef: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 400 | $TYPES{CodeRef} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 401 | name => 'CodeRef', | ||||||||||||||||||||||||||||||||||||||||||
| 402 | parent => Ref(), | ||||||||||||||||||||||||||||||||||||||||||
| 403 | constraint => \&is_CodeRef, | ||||||||||||||||||||||||||||||||||||||||||
| 404 | 9 | ▶ | inlined => sub { "ref($_[1]) eq 'CODE'" }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 10 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"CodeRef"} ||= "TUI::Type::Object"->new("name", "CodeRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_CodeRef, "inlined", sub {
"ref($_[1]) eq 'CODE'";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"CodeRef"} ||= "TUI::Type::Object"->new("name", "CodeRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_CodeRef, "inlined", sub {
"ref($_[1]) eq 'CODE'";
}
)
$TUI::toolkit::Types::TYPES{"CodeRef"}
"TUI::Type::Object"->new("name", "CodeRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_CodeRef, "inlined", sub {
"ref($_[1]) eq 'CODE'";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"CodeRef"}B= "TUI::Type::Object"->new("name", "CodeRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_CodeRef, "inlined", sub {
"ref($_[1]) eq 'CODE'";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | 2 | ▶ | sub GlobRef () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
GlobRef: called CC=2 SCAR=8.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 409 | $TYPES{GlobRef} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 410 | name => 'GlobRef', | ||||||||||||||||||||||||||||||||||||||||||
| 411 | parent => Ref(), | ||||||||||||||||||||||||||||||||||||||||||
| 412 | constraint => \&is_GlobRef, | ||||||||||||||||||||||||||||||||||||||||||
| 413 | 1 | ▶ | inlined => sub { "ref($_[1]) eq 'GLOB'" }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 414 | 2 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$TUI::toolkit::Types::TYPES{"GlobRef"} ||= "TUI::Type::Object"->new("name", "GlobRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_GlobRef, "inlined", sub {
"ref($_[1]) eq 'GLOB'";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"GlobRef"} ||= "TUI::Type::Object"->new("name", "GlobRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_GlobRef, "inlined", sub {
"ref($_[1]) eq 'GLOB'";
}
)
$TUI::toolkit::Types::TYPES{"GlobRef"}
"TUI::Type::Object"->new("name", "GlobRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_GlobRef, "inlined", sub {
"ref($_[1]) eq 'GLOB'";
}
)
Truth table33%1/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"GlobRef"}B= "TUI::Type::Object"->new("name", "GlobRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_GlobRef, "inlined", sub {
"ref($_[1]) eq 'GLOB'";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | 8 | ▶ | sub FileHandle () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FileHandle: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 418 | 8 | ▶ | $TYPES{FileHandle} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"FileHandle"} ||= "TUI::Type::Object"->new("name", "FileHandle", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_FileHandle)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"FileHandle"} ||= "TUI::Type::Object"->new("name", "FileHandle", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_FileHandle)
$TUI::toolkit::Types::TYPES{"FileHandle"}
"TUI::Type::Object"->new("name", "FileHandle", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_FileHandle)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"FileHandle"}B= "TUI::Type::Object"->new("name", "FileHandle", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_FileHandle)
| |||||||||||||||||||||||||||||||||||||||||||
| 419 | name => 'FileHandle', | ||||||||||||||||||||||||||||||||||||||||||
| 420 | parent => Ref(), | ||||||||||||||||||||||||||||||||||||||||||
| 421 | constraint => \&is_FileHandle, | ||||||||||||||||||||||||||||||||||||||||||
| 422 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 426 | # Type constructors (parametric) | ||||||||||||||||||||||||||||||||||||||||||
| 427 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | 41 | ▶ | sub Maybe ($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Maybe: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 430 | 41 | my ( $param ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 431 | 41 | ▶ | my $type = $TYPES{Maybe} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"Maybe"} ||= "TUI::Type::Object"->new("name", "Maybe", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Any)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"Maybe"} ||= "TUI::Type::Object"->new("name", "Maybe", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Any)
$TUI::toolkit::Types::TYPES{"Maybe"}
"TUI::Type::Object"->new("name", "Maybe", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Any)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"Maybe"}B= "TUI::Type::Object"->new("name", "Maybe", "parent", &Item(), "constraint", \&TUI::toolkit::Types::is_Any)
| |||||||||||||||||||||||||||||||||||||||||||
| 432 | name => 'Maybe', | ||||||||||||||||||||||||||||||||||||||||||
| 433 | parent => Item, | ||||||||||||||||||||||||||||||||||||||||||
| 434 | constraint => \&is_Any, | ||||||||||||||||||||||||||||||||||||||||||
| 435 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | return _param_type( | ||||||||||||||||||||||||||||||||||||||||||
| 438 | name => 'Maybe', | ||||||||||||||||||||||||||||||||||||||||||
| 439 | param => $param, | ||||||||||||||||||||||||||||||||||||||||||
| 440 | parent => $type, | ||||||||||||||||||||||||||||||||||||||||||
| 441 | 41 | ▶ | constraint_generator => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | 41 | my ( $inner ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 443 | 189 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 444 | 189 | my ( $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 445 | 189 | ▶ | return !!1 unless defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 446 | 133 | return $inner->check( $value ); | |||||||||||||||||||||||||||||||||||||||||
| 447 | 41 | }; | |||||||||||||||||||||||||||||||||||||||||
| 448 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 449 | 41 | ); | |||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | 149 | ▶ | sub Ref (;$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Ref: called CC=3 SCAR=18.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 453 | my $type = $TYPES{Ref} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 454 | name => 'Ref', | ||||||||||||||||||||||||||||||||||||||||||
| 455 | parent => Defined, | ||||||||||||||||||||||||||||||||||||||||||
| 456 | constraint => \&is_Ref, | ||||||||||||||||||||||||||||||||||||||||||
| 457 | 1 | ▶ | inlined => sub { "!!ref($_[1])" }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 458 | 149 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"Ref"} ||= "TUI::Type::Object"->new("name", "Ref", "parent", &Defined(), "constraint", \&TUI::toolkit::Types::is_Ref, "inlined", sub {
"!!ref($_[1])";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"Ref"} ||= "TUI::Type::Object"->new("name", "Ref", "parent", &Defined(), "constraint", \&TUI::toolkit::Types::is_Ref, "inlined", sub {
"!!ref($_[1])";
}
)
$TUI::toolkit::Types::TYPES{"Ref"}
"TUI::Type::Object"->new("name", "Ref", "parent", &Defined(), "constraint", \&TUI::toolkit::Types::is_Ref, "inlined", sub {
"!!ref($_[1])";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"Ref"}B= "TUI::Type::Object"->new("name", "Ref", "parent", &Defined(), "constraint", \&TUI::toolkit::Types::is_Ref, "inlined", sub {
"!!ref($_[1])";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 459 | 149 | ▶ | return $type unless @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||
| 461 | 1 | my ( $param ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 462 | return _param_type( | ||||||||||||||||||||||||||||||||||||||||||
| 463 | name => 'Ref', | ||||||||||||||||||||||||||||||||||||||||||
| 464 | param => $param, | ||||||||||||||||||||||||||||||||||||||||||
| 465 | parent => $type, | ||||||||||||||||||||||||||||||||||||||||||
| 466 | 1 | ▶ | constraint_generator => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=6.0
| |||||||||||||||||||||||||||||||||||||||||||
| 467 | 1 | my ( $inner ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my ( $ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | SWITCH: for ( ref $ref ) { | |||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | ▶ | /SCALAR/ and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | return !!0 unless $inner->check( $$ref ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 474 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | ▶ | /ARRAY/ and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | foreach ( @$ref ) { | |||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | ▶ | return !!0 unless $inner->check( $_ ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 480 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | ▶ | /HASH/ and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | foreach ( values %$ref ) { | |||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | return !!0 unless $inner->check( $_ ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 486 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 487 | DEFAULT: { | ||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | return !!0; | |||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||
| 490 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | return !!1; | |||||||||||||||||||||||||||||||||||||||||
| 492 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 493 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 494 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||
| 497 | 4 | ▶ | sub ScalarRef (;$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ScalarRef: called CC=3 SCAR=13.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 498 | my $type = $TYPES{ScalarRef} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 499 | name => 'ScalarRef', | ||||||||||||||||||||||||||||||||||||||||||
| 500 | parent => Ref, | ||||||||||||||||||||||||||||||||||||||||||
| 501 | constraint => \&is_ScalarRef, | ||||||||||||||||||||||||||||||||||||||||||
| 502 | 2 | ▶ | inlined => sub { "ref($_[1]) eq 'SCALAR' || ref($_[1]) eq 'REF'" }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 503 | 4 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"ScalarRef"} ||= "TUI::Type::Object"->new("name", "ScalarRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_ScalarRef, "inlined", sub {
"ref($_[1]) eq 'SCALAR' || ref($_[1]) eq 'REF'";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"ScalarRef"} ||= "TUI::Type::Object"->new("name", "ScalarRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_ScalarRef, "inlined", sub {
"ref($_[1]) eq 'SCALAR' || ref($_[1]) eq 'REF'";
}
)
$TUI::toolkit::Types::TYPES{"ScalarRef"}
"TUI::Type::Object"->new("name", "ScalarRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_ScalarRef, "inlined", sub {
"ref($_[1]) eq 'SCALAR' || ref($_[1]) eq 'REF'";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"ScalarRef"}B= "TUI::Type::Object"->new("name", "ScalarRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_ScalarRef, "inlined", sub {
"ref($_[1]) eq 'SCALAR' || ref($_[1]) eq 'REF'";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 504 | 4 | ▶ | return $type unless @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||
| 506 | 1 | my ( $param ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 507 | return _param_type( | ||||||||||||||||||||||||||||||||||||||||||
| 508 | name => 'ScalarRef', | ||||||||||||||||||||||||||||||||||||||||||
| 509 | param => $param, | ||||||||||||||||||||||||||||||||||||||||||
| 510 | parent => $type, | ||||||||||||||||||||||||||||||||||||||||||
| 511 | 1 | ▶ | constraint_generator => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=4.1
| |||||||||||||||||||||||||||||||||||||||||||
| 512 | 1 | my ( $inner ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | my ( $ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | return !!0 unless is_ScalarRef( $ref ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | ▶ | return !!0 unless $inner->check( $$ref ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | return !!1; | |||||||||||||||||||||||||||||||||||||||||
| 518 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 519 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 520 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||
| 523 | 17 | ▶ | sub ArrayRef (;$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ArrayRef: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 524 | my $type = $TYPES{ArrayRef} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 525 | name => 'ArrayRef', | ||||||||||||||||||||||||||||||||||||||||||
| 526 | parent => Ref, | ||||||||||||||||||||||||||||||||||||||||||
| 527 | constraint => \&is_ArrayRef, | ||||||||||||||||||||||||||||||||||||||||||
| 528 | 5 | ▶ | inlined => sub { "ref($_[1]) eq 'ARRAY'" }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 529 | 17 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"ArrayRef"} ||= "TUI::Type::Object"->new("name", "ArrayRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_ArrayRef, "inlined", sub {
"ref($_[1]) eq 'ARRAY'";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"ArrayRef"} ||= "TUI::Type::Object"->new("name", "ArrayRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_ArrayRef, "inlined", sub {
"ref($_[1]) eq 'ARRAY'";
}
)
$TUI::toolkit::Types::TYPES{"ArrayRef"}
"TUI::Type::Object"->new("name", "ArrayRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_ArrayRef, "inlined", sub {
"ref($_[1]) eq 'ARRAY'";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"ArrayRef"}B= "TUI::Type::Object"->new("name", "ArrayRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_ArrayRef, "inlined", sub {
"ref($_[1]) eq 'ARRAY'";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 530 | 17 | ▶ | return $type unless @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||
| 532 | 7 | my ( $param ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 533 | return _param_type( | ||||||||||||||||||||||||||||||||||||||||||
| 534 | name => 'ArrayRef', | ||||||||||||||||||||||||||||||||||||||||||
| 535 | param => $param, | ||||||||||||||||||||||||||||||||||||||||||
| 536 | parent => $type, | ||||||||||||||||||||||||||||||||||||||||||
| 537 | 7 | ▶ | constraint_generator => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 538 | 7 | my ( $inner ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 539 | 5 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 540 | 5 | my ( $ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 541 | 5 | ▶ | return !!0 unless is_ArrayRef( $ref ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 542 | 5 | foreach ( @$ref ) { | |||||||||||||||||||||||||||||||||||||||||
| 543 | 12 | ▶ | return !!0 unless $inner->check( $_ ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||
| 545 | 3 | return !!1; | |||||||||||||||||||||||||||||||||||||||||
| 546 | 7 | }; | |||||||||||||||||||||||||||||||||||||||||
| 547 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 548 | 7 | ); | |||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||
| 551 | 10 | ▶ | sub HashRef (;$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
HashRef: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 552 | my $type = $TYPES{HashRef} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 553 | name => 'HashRef', | ||||||||||||||||||||||||||||||||||||||||||
| 554 | parent => Ref, | ||||||||||||||||||||||||||||||||||||||||||
| 555 | constraint => \&is_HashRef, | ||||||||||||||||||||||||||||||||||||||||||
| 556 | 6 | ▶ | inlined => sub { "ref($_[1]) eq 'HASH'" }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 557 | 10 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"HashRef"} ||= "TUI::Type::Object"->new("name", "HashRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_HashRef, "inlined", sub {
"ref($_[1]) eq 'HASH'";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"HashRef"} ||= "TUI::Type::Object"->new("name", "HashRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_HashRef, "inlined", sub {
"ref($_[1]) eq 'HASH'";
}
)
$TUI::toolkit::Types::TYPES{"HashRef"}
"TUI::Type::Object"->new("name", "HashRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_HashRef, "inlined", sub {
"ref($_[1]) eq 'HASH'";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"HashRef"}B= "TUI::Type::Object"->new("name", "HashRef", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_HashRef, "inlined", sub {
"ref($_[1]) eq 'HASH'";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 558 | 10 | ▶ | return $type unless @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||
| 560 | 2 | my ( $param ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 561 | return _param_type( | ||||||||||||||||||||||||||||||||||||||||||
| 562 | name => 'HashRef', | ||||||||||||||||||||||||||||||||||||||||||
| 563 | param => $param, | ||||||||||||||||||||||||||||||||||||||||||
| 564 | parent => $type, | ||||||||||||||||||||||||||||||||||||||||||
| 565 | 2 | ▶ | constraint_generator => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 566 | 2 | my ( $inner ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 567 | 3 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 568 | 3 | my ( $ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 569 | 3 | ▶ | return !!0 unless is_HashRef( $ref ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 570 | 3 | foreach ( values %$ref ) { | |||||||||||||||||||||||||||||||||||||||||
| 571 | 6 | ▶ | return !!0 unless $inner->check( $_ ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||
| 573 | 2 | return !!1; | |||||||||||||||||||||||||||||||||||||||||
| 574 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||
| 575 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 576 | 2 | ); | |||||||||||||||||||||||||||||||||||||||||
| 577 | } | ||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||
| 579 | 8 | ▶ | sub ArrayLike (;$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ArrayLike: called CC=3 SCAR=18.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 580 | my $type = $TYPES{ArrayLike} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 581 | name => 'ArrayLike', | ||||||||||||||||||||||||||||||||||||||||||
| 582 | parent => Ref, | ||||||||||||||||||||||||||||||||||||||||||
| 583 | constraint => \&is_ArrayLike, | ||||||||||||||||||||||||||||||||||||||||||
| 584 | 6 | ▶ | inlined => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 585 | 6 | "do { require Scalar::Util; Scalar::Util::reftype($_[1]) eq 'ARRAY' }" | |||||||||||||||||||||||||||||||||||||||||
| 586 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 587 | 8 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"ArrayLike"} ||= "TUI::Type::Object"->new("name", "ArrayLike", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_ArrayLike, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::reftype($_[1]) eq 'ARRAY' }";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"ArrayLike"} ||= "TUI::Type::Object"->new("name", "ArrayLike", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_ArrayLike, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::reftype($_[1]) eq 'ARRAY' }";
}
)
$TUI::toolkit::Types::TYPES{"ArrayLike"}
"TUI::Type::Object"->new("name", "ArrayLike", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_ArrayLike, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::reftype($_[1]) eq 'ARRAY' }";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"ArrayLike"}B= "TUI::Type::Object"->new("name", "ArrayLike", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_ArrayLike, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::reftype($_[1]) eq 'ARRAY' }";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 588 | 8 | ▶ | return $type unless @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | my ( $param ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 591 | return _param_type( | ||||||||||||||||||||||||||||||||||||||||||
| 592 | name => 'ArrayLike', | ||||||||||||||||||||||||||||||||||||||||||
| 593 | param => $param, | ||||||||||||||||||||||||||||||||||||||||||
| 594 | parent => $type, | ||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | constraint_generator => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | my ( $inner ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | my ( $ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | ▶ | return !!0 unless is_ArrayLike( $ref ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | foreach ( @$ref ) { | |||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | ▶ | return !!0 unless $inner->check( $_ ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | return !!1; | |||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 605 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||
| 609 | 15 | ▶ | sub HashLike (;$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
HashLike: called CC=3 SCAR=18.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 610 | my $type = $TYPES{HashLike} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 611 | name => 'HashLike', | ||||||||||||||||||||||||||||||||||||||||||
| 612 | parent => Ref, | ||||||||||||||||||||||||||||||||||||||||||
| 613 | constraint => \&is_HashLike, | ||||||||||||||||||||||||||||||||||||||||||
| 614 | 15 | ▶ | inlined => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 615 | 15 | "do { require Scalar::Util; Scalar::Util::reftype($_[1]) eq 'HASH' }" | |||||||||||||||||||||||||||||||||||||||||
| 616 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 617 | 15 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"HashLike"} ||= "TUI::Type::Object"->new("name", "HashLike", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_HashLike, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::reftype($_[1]) eq 'HASH' }";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"HashLike"} ||= "TUI::Type::Object"->new("name", "HashLike", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_HashLike, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::reftype($_[1]) eq 'HASH' }";
}
)
$TUI::toolkit::Types::TYPES{"HashLike"}
"TUI::Type::Object"->new("name", "HashLike", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_HashLike, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::reftype($_[1]) eq 'HASH' }";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"HashLike"}B= "TUI::Type::Object"->new("name", "HashLike", "parent", &Ref(), "constraint", \&TUI::toolkit::Types::is_HashLike, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::reftype($_[1]) eq 'HASH' }";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 618 | 15 | ▶ | return $type unless @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | my ( $param ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 621 | return _param_type( | ||||||||||||||||||||||||||||||||||||||||||
| 622 | kind => 'HashLike', | ||||||||||||||||||||||||||||||||||||||||||
| 623 | param => $param, | ||||||||||||||||||||||||||||||||||||||||||
| 624 | parent => $type, | ||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | ▶ | constraint_generator => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | my ( $inner ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | my ( $ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | ▶ | return !!0 unless is_HashLike( $ref ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | foreach ( values %$ref ) { | |||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | ▶ | return !!0 unless $inner->check( $_ ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 632 | } | ||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | return !!1; | |||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 635 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||
| 639 | 4 | ▶ | sub InstanceOf (;$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
InstanceOf: called CC=7 SCAR=20.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 640 | my $type = $TYPES{InstanceOf} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 641 | name => 'InstanceOf', | ||||||||||||||||||||||||||||||||||||||||||
| 642 | parent => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 643 | constraint => \&is_Object, | ||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | ▶ | inlined => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | "do { require Scalar::Util; Scalar::Util::blessed($_[1]) }" | |||||||||||||||||||||||||||||||||||||||||
| 646 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 647 | 4 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$TUI::toolkit::Types::TYPES{"InstanceOf"} ||= "TUI::Type::Object"->new("name", "InstanceOf", "parent", &Object(), "constraint", \&TUI::toolkit::Types::is_Object, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::blessed($_[1]) }";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"InstanceOf"} ||= "TUI::Type::Object"->new("name", "InstanceOf", "parent", &Object(), "constraint", \&TUI::toolkit::Types::is_Object, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::blessed($_[1]) }";
}
)
$TUI::toolkit::Types::TYPES{"InstanceOf"}
"TUI::Type::Object"->new("name", "InstanceOf", "parent", &Object(), "constraint", \&TUI::toolkit::Types::is_Object, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::blessed($_[1]) }";
}
)
Truth table66%2/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"InstanceOf"}B= "TUI::Type::Object"->new("name", "InstanceOf", "parent", &Object(), "constraint", \&TUI::toolkit::Types::is_Object, "inlined", sub {
"do { require Scalar::Util; Scalar::Util::blessed($_[1]) }";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 648 | 4 | ▶ | return $type unless @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||
| 650 | 3 | my ( $param ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 651 | 3 | ▶ | Carp::croak "Expects param to be an array reference" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 652 | unless is_ArrayRef( $param ); | ||||||||||||||||||||||||||||||||||||||||||
| 653 | Carp::croak "Expects a string as inner type" | ||||||||||||||||||||||||||||||||||||||||||
| 654 | 3 | ▶ | if grep { not is_Str( $_ ) } @$param; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||
| 656 | # If only one parameter is given, we can generate a simple type | ||||||||||||||||||||||||||||||||||||||||||
| 657 | 3 | ▶ | if ( @$param == 1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 658 | 2 | my $class = shift @$param; | |||||||||||||||||||||||||||||||||||||||||
| 659 | return $TYPES{CLASS}{$class} ||= TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 660 | name => $class, | ||||||||||||||||||||||||||||||||||||||||||
| 661 | parent => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 662 | 4 | ▶ | constraint => sub { $_->isa( $class ) }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | ▶ | inlined => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | "do { require Scalar::Util; " . | |||||||||||||||||||||||||||||||||||||||||
| 665 | "Scalar::Util::blessed($_[1]) && $_[1]->isa(q[$class]) }" | ||||||||||||||||||||||||||||||||||||||||||
| 666 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 667 | 2 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$TUI::toolkit::Types::TYPES{"CLASS"}{$class} ||= "TUI::Type::Object"->new("name", $class, "parent", &Object(), "constraint", sub {
$_->isa($class);
}
, "inlined", sub {
'do { require Scalar::Util; ' . "Scalar::Util::blessed($_[1]) && $_[1]->isa(q[$class]) }";
}
)
MC/DC0%0/2
$TUI::toolkit::Types::TYPES{"CLASS"}{$class} ||= "TUI::Type::Object"->new("name", $class, "parent", &Object(), "constraint", sub {
$_->isa($class);
}
, "inlined", sub {
'do { require Scalar::Util; ' . "Scalar::Util::blessed($_[1]) && $_[1]->isa(q[$class]) }";
}
)
$TUI::toolkit::Types::TYPES{"CLASS"}{$class}
"TUI::Type::Object"->new("name", $class, "parent", &Object(), "constraint", sub {
$_->isa($class);
}
, "inlined", sub {
'do { require Scalar::Util; ' . "Scalar::Util::blessed($_[1]) && $_[1]->isa(q[$class]) }";
}
)
Truth table33%1/3
A ||= B
A= $TUI::toolkit::Types::TYPES{"CLASS"}{$class}B= "TUI::Type::Object"->new("name", $class, "parent", &Object(), "constraint", sub {
$_->isa($class);
}
, "inlined", sub {
'do { require Scalar::Util; ' . "Scalar::Util::blessed($_[1]) && $_[1]->isa(q[$class]) }";
}
)
| |||||||||||||||||||||||||||||||||||||||||||
| 668 | } | ||||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||
| 670 | # Generate a union type that accepts any of the given classes | ||||||||||||||||||||||||||||||||||||||||||
| 671 | 1 | my @classes = @$param; | |||||||||||||||||||||||||||||||||||||||||
| 672 | return TUI::Type::Object->new( | ||||||||||||||||||||||||||||||||||||||||||
| 673 | name => '__ANON__', | ||||||||||||||||||||||||||||||||||||||||||
| 674 | parent => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 675 | 2 | ▶ | constraint => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 676 | 2 | !! grep { $_[0]->isa( $_ ) } @classes; | |||||||||||||||||||||||||||||||||||||||||
| 677 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 678 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 682 | # Parametric core | ||||||||||||||||||||||||||||||||||||||||||
| 683 | # ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | 52 | ▶ | sub _param_type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_param_type: called CC=11 SCAR=26.5
| |||||||||||||||||||||||||||||||||||||||||||
| 686 | 52 | my ( %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 687 | 52 | my $kind = $args{name}; | |||||||||||||||||||||||||||||||||||||||||
| 688 | 52 | my $ref = $args{param}; | |||||||||||||||||||||||||||||||||||||||||
| 689 | 52 | my $parent = $args{parent}; | |||||||||||||||||||||||||||||||||||||||||
| 690 | 52 | my $builder = $args{constraint_generator}; | |||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||
| 692 | # Basic checks | ||||||||||||||||||||||||||||||||||||||||||
| 693 | 52 | ▶ | Carp::croak "Missing required argument 'name'" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 694 | unless defined $kind; | ||||||||||||||||||||||||||||||||||||||||||
| 695 | 52 | ▶ | Carp::croak "Missing required argument 'param'" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 696 | unless defined $ref; | ||||||||||||||||||||||||||||||||||||||||||
| 697 | 52 | ▶ | Carp::croak "Missing required argument 'constraint_generator'" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 698 | unless defined $builder; | ||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||
| 700 | # Check argument types | ||||||||||||||||||||||||||||||||||||||||||
| 701 | 52 | ▶ | Carp::croak "Expects name to be a string" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 702 | unless is_Str( $kind ); | ||||||||||||||||||||||||||||||||||||||||||
| 703 | 52 | ▶ | Carp::croak "Expects constraint_generator to be a code ref" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 704 | unless is_CodeRef( $builder ); | ||||||||||||||||||||||||||||||||||||||||||
| 705 | 52 | ▶ | Carp::croak "Expects param to be an array reference" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 706 | unless is_ArrayRef( $ref ); | ||||||||||||||||||||||||||||||||||||||||||
| 707 | 52 | ▶ | Carp::croak "Expects param array ref to hold exactly one type" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 708 | unless @$ref == 1; | ||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||
| 710 | # Check if inner is a Type-API style object | ||||||||||||||||||||||||||||||||||||||||||
| 711 | 52 | my ( $inner ) = @$ref; | |||||||||||||||||||||||||||||||||||||||||
| 712 | 52 | ▶ | Carp::croak "Expects a type constraint object as inner type" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($inner) and $inner->can("check")
MC/DC0%0/2
builtin::blessed($inner) and $inner->can("check")
builtin::blessed($inner)
$inner->can("check")
Truth table33%1/3
A and B
A= builtin::blessed($inner)B= $inner->can("check")
| |||||||||||||||||||||||||||||||||||||||||||
| 713 | unless blessed( $inner ) && $inner->can( 'check' ); | ||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||
| 715 | 52 | ▶ | my $a = $inner->{name} || '__ANON__'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$inner->{'name'} || '__ANON__'
MC/DC0%0/1
$inner->{'name'} || '__ANON__'
$inner->{'name'}
Truth table50%1/2
A
A= $inner->{'name'}
| |||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||
| 717 | # Generate the type object | ||||||||||||||||||||||||||||||||||||||||||
| 718 | 52 | return TUI::Type::Object->new( | |||||||||||||||||||||||||||||||||||||||||
| 719 | name => "$kind\[$a\]", | ||||||||||||||||||||||||||||||||||||||||||
| 720 | parent => $parent, | ||||||||||||||||||||||||||||||||||||||||||
| 721 | constraint => $builder->( $inner ), | ||||||||||||||||||||||||||||||||||||||||||
| 722 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 723 | } | ||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||
| 725 | 136 | 1 | |||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||
| 727 | __END__ | ||||||||||||||||||||||||||||||||||||||||||