lib/TUI/toolkit/Types.pm

filter: Statementstmt 82.9% 219 / 264 Branchbran 57.3% 70 / 122 Conditioncond 57.0% 57 / 100 MC/DCmcdc 4.6% 3 / 64 Subroutinesub 89.9% 98 / 109 Podpod 47.8% 22 / 46 totaltotal 66.5% 469 / 705 CC 104 SCAR 22.6
CC
104
Cov
71%
__ANON__
110.0
__ANON__
20.0
__ANON__
20.0
CRAP 9.6
« lib/TUI/Gadgets/MouseDialog.pm ↑ Summary lib/TUI/TextView/TextDevice.pm »
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
BranchTrueFalseTotal
if $roles{$role} 105 407 512
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
BranchTrueFalseTotal
unless exists $spec{"name"} 0 1149 1149
149 1149 ▶ die "missing constraint" unless exists $spec{constraint};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $spec{"constraint"} 0 1149 1149
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
BranchTrueFalseTotal
if ($param->{"parent"}) 2267 635 2902
156 2267 ▶ return !!0 unless $param->{parent}->check( $value );
Branch: 1 branch
BranchTrueFalseTotal
unless $param->{"parent"}->check($value) 93 2174 2267
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
BranchTrueFalseTotal
ref $value ? : 56 33 89
defined $value ? : 26 7 33
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
BranchTrueFalseTotal
unless defined $name and not ref $name and length $name 0 1080 1080
Condition33%2/6
defined $name and not ref $name and length $name
!ll&&!rl&&r
001080
defined $name and not ref $name
!ll&&!rl&&r
001080
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
ABCresult
0XX0
10X0
1100
1111
178 1080 ▶ return unless ref( $param->{inlined} ) eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $param->{"inlined"} eq "CODE" 7 1073 1080
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
BranchTrueFalseTotal
$param->check($value) or Carp::croak($param->get_message($value)) 56 79 135
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
BranchTrueFalseTotal
defined $_[0] and not ref $_[0] 205 2 207
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
BranchTrueFalseTotal
defined $_[0] and ref \$_[0] eq "SCALAR" 515 0 515
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
BranchTrueFalseTotal
not defined $_[0] or $_[0] =~ /\A[01]?\z/ 4 28 32
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
BranchTrueFalseTotal
defined $_[0] and $_[0] =~ /\A-?\d+\z/ 111 0 111
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
BranchTrueFalseTotal
defined $_[0] and $_[0] =~ /\A[1-9]\d*\z/ 20 0 20
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
BranchTrueFalseTotal
defined $_[0] and $_[0] =~ /\A\d+\z/ 73740 0 73740
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
BranchTrueFalseTotal
ref $_[0] eq "SCALAR" or ref $_[0] eq "REF" 4 18 22
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
BranchTrueFalseTotal
unless $value and ref \$value eq "SCALAR" 2 8 10
Condition66%2/3
$value and ref \$value eq "SCALAR"
!ll&&!rl&&r
208
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"
ABresult
0X0
100
111
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
BranchTrueFalseTotal
if exists $stash->{"ISA"} and *{$stash->{"ISA"};}{"ARRAY"} and @{"${value}::ISA";} 0 8 8
Condition40%2/5
exists $stash->{"ISA"} and *{$stash->{"ISA"};}{"ARRAY"} and @{"${value}::ISA";}
!ll&&!rl&&r
800
exists $stash->{"ISA"} and *{$stash->{"ISA"};}{"ARRAY"}
!ll
80
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";}
ABresult
0X0
100
111
246
247 # .. or $VERSION ..
248 8 ▶ return !!1 if exists $stash->{'VERSION'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $stash->{"VERSION"} 4 4 8
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
BranchTrueFalseTotal
if &is_GlobRef(\$symbol) ? *{$symbol;}{"CODE"} : ref $symbol 2 0 2
&is_GlobRef(\$symbol) ? : 2 0 2
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
BranchTrueFalseTotal
if ref $_[0] and &openhandle($_[0]) 18 8 26
Condition100%3/3
ref $_[0] and &openhandle($_[0])
!ll&&!rl&&r
2618
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])
ABresult
0X0
100
111
263 8 ▶ return !!1 if blessed($_[0]) && $_[0]->isa( "IO::Handle" );
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($_[0]) and $_[0]->isa("IO::Handle") 0 8 8
Condition33%1/3
builtin::blessed($_[0]) and $_[0]->isa("IO::Handle")
!ll&&!rl&&r
800
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")
ABresult
0X0
100
111
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
BranchTrueFalseTotal
ref $_[0] and builtin::reftype($_[0]) eq "ARRAY" 113 0 113
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
BranchTrueFalseTotal
ref $_[0] and builtin::reftype($_[0]) eq "HASH" 0 0 0
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; } )
l!l&&r!l&&!r
121310
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; } )
ABresult
1X1
011
000
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; } )
l!l&&r!l&&!r
381310
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; } )
ABresult
1X1
011
000
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])"; } )
l!l&&r!l&&!r
020
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])"; } )
ABresult
1X1
011
000
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])"; } )
l!l&&r!l&&!r
3131310
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])"; } )
ABresult
1X1
011
000
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])"; } )
l!l&&r!l&&!r
191260
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])"; } )
ABresult
1X1
011
000
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/ }"; } )
l!l&&r!l&&!r
1090
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/ }"; } )
ABresult
1X1
011
000
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' }"; } )
l!l&&r!l&&!r
57200
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' }"; } )
ABresult
1X1
011
000
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)
l!l&&r!l&&!r
030
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)
ABresult
1X1
011
000
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]) }"; } )
l!l&&r!l&&!r
241230
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]) }"; } )
ABresult
1X1
011
000
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/ }"; } )
l!l&&r!l&&!r
1951230
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/ }"; } )
ABresult
1X1
011
000
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/ }"; } )
l!l&&r!l&&!r
020
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/ }"; } )
ABresult
1X1
011
000
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/ }"; } )
l!l&&r!l&&!r
17110
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/ }"; } )
ABresult
1X1
011
000
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]) }"; } )
l!l&&r!l&&!r
3061200
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]) }"; } )
ABresult
1X1
011
000
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'"; } )
l!l&&r!l&&!r
460
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'"; } )
ABresult
1X1
011
000
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'"; } )
l!l&&r!l&&!r
020
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'"; } )
ABresult
1X1
011
000
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)
l!l&&r!l&&!r
530
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)
ABresult
1X1
011
000
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)
l!l&&r!l&&!r
30110
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)
ABresult
1X1
011
000
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
BranchTrueFalseTotal
unless defined $value 56 133 189
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])"; } )
l!l&&r!l&&!r
251240
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])"; } )
ABresult
1X1
011
000
459 149 ▶ return $type unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 148 1 149
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
BranchTrueFalseTotal
/SCALAR/ and 0 0 0
472 0 ▶ return !!0 unless $inner->check( $$ref );
Branch: 1 branch
BranchTrueFalseTotal
unless $inner->check($$ref) 0 0 0
473 0 last;
474 };
475 0 ▶ /ARRAY/ and do {
Branch: 1 branch
BranchTrueFalseTotal
/ARRAY/ and 0 0 0
476 0 foreach ( @$ref ) {
477 0 ▶ return !!0 unless $inner->check( $_ );
Branch: 1 branch
BranchTrueFalseTotal
unless $inner->check($_) 0 0 0
478 }
479 0 last;
480 };
481 0 ▶ /HASH/ and do {
Branch: 1 branch
BranchTrueFalseTotal
/HASH/ and 0 0 0
482 0 foreach ( values %$ref ) {
483 0 ▶ return !!0 unless $inner->check( $_ );
Branch: 1 branch
BranchTrueFalseTotal
unless $inner->check($_) 0 0 0
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'"; } )
l!l&&r!l&&!r
130
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'"; } )
ABresult
1X1
011
000
504 4 ▶ return $type unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 3 1 4
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
BranchTrueFalseTotal
unless &is_ScalarRef($ref) 0 0 0
516 0 ▶ return !!0 unless $inner->check( $$ref );
Branch: 1 branch
BranchTrueFalseTotal
unless $inner->check($$ref) 0 0 0
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'"; } )
l!l&&r!l&&!r
1340
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'"; } )
ABresult
1X1
011
000
530 17 ▶ return $type unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 10 7 17
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
BranchTrueFalseTotal
unless &is_ArrayRef($ref) 0 5 5
542 5 foreach ( @$ref ) {
543 12 ▶ return !!0 unless $inner->check( $_ );
Branch: 1 branch
BranchTrueFalseTotal
unless $inner->check($_) 2 10 12
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'"; } )
l!l&&r!l&&!r
730
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'"; } )
ABresult
1X1
011
000
558 10 ▶ return $type unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 8 2 10
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
BranchTrueFalseTotal
unless &is_HashRef($ref) 0 3 3
570 3 foreach ( values %$ref ) {
571 6 ▶ return !!0 unless $inner->check( $_ );
Branch: 1 branch
BranchTrueFalseTotal
unless $inner->check($_) 1 5 6
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' }"; } )
l!l&&r!l&&!r
530
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' }"; } )
ABresult
1X1
011
000
588 8 ▶ return $type unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 8 0 8
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
BranchTrueFalseTotal
unless &is_ArrayLike($ref) 0 0 0
600 0 foreach ( @$ref ) {
601 0 ▶ return !!0 unless $inner->check( $_ );
Branch: 1 branch
BranchTrueFalseTotal
unless $inner->check($_) 0 0 0
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' }"; } )
l!l&&r!l&&!r
1320
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' }"; } )
ABresult
1X1
011
000
618 15 ▶ return $type unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 15 0 15
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
BranchTrueFalseTotal
unless &is_HashLike($ref) 0 0 0
630 0 foreach ( values %$ref ) {
631 0 ▶ return !!0 unless $inner->check( $_ );
Branch: 1 branch
BranchTrueFalseTotal
unless $inner->check($_) 0 0 0
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]) }"; } )
l!l&&r!l&&!r
310
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]) }"; } )
ABresult
1X1
011
000
648 4 ▶ return $type unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 1 3 4
649
650 3 my ( $param ) = @_;
651 3 ▶ Carp::croak "Expects param to be an array reference"
Branch: 1 branch
BranchTrueFalseTotal
unless &is_ArrayRef($param) 0 3 3
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
BranchTrueFalseTotal
if grep {not &is_Str($_);} @$param 0 3 3
655
656 # If only one parameter is given, we can generate a simple type
657 3 ▶ if ( @$param == 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$param == 1) 2 1 3
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]) }"; } )
l!l&&r!l&&!r
020
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]) }"; } )
ABresult
1X1
011
000
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
BranchTrueFalseTotal
unless defined $kind 0 52 52
694 unless defined $kind;
695 52 ▶ Carp::croak "Missing required argument 'param'"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ref 0 52 52
696 unless defined $ref;
697 52 ▶ Carp::croak "Missing required argument 'constraint_generator'"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $builder 0 52 52
698 unless defined $builder;
699
700 # Check argument types
701 52 ▶ Carp::croak "Expects name to be a string"
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Str($kind) 0 52 52
702 unless is_Str( $kind );
703 52 ▶ Carp::croak "Expects constraint_generator to be a code ref"
Branch: 1 branch
BranchTrueFalseTotal
unless &is_CodeRef($builder) 0 52 52
704 unless is_CodeRef( $builder );
705 52 ▶ Carp::croak "Expects param to be an array reference"
Branch: 1 branch
BranchTrueFalseTotal
unless &is_ArrayRef($ref) 0 52 52
706 unless is_ArrayRef( $ref );
707 52 ▶ Carp::croak "Expects param array ref to hold exactly one type"
Branch: 1 branch
BranchTrueFalseTotal
unless @$ref == 1 0 52 52
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
BranchTrueFalseTotal
unless builtin::blessed($inner) and $inner->can("check") 0 52 52
Condition33%1/3
builtin::blessed($inner) and $inner->can("check")
!ll&&!rl&&r
0052
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")
ABresult
0X0
100
111
713 unless blessed( $inner ) && $inner->can( 'check' );
714
715 52 ▶ my $a = $inner->{name} || '__ANON__';
Condition50%1/2
$inner->{'name'} || '__ANON__'
l!l
520
MC/DC0%0/1
$inner->{'name'} || '__ANON__'
$inner->{'name'}
Truth table50%1/2
A
A= $inner->{'name'}
Aresult
11
00
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__
« lib/TUI/Gadgets/MouseDialog.pm ↑ Summary lib/TUI/TextView/TextDevice.pm »