lib/TUI/toolkit/Types.pm

filter: Statementstmt 84.4% 223 / 264 Branchbran 59.0% 72 / 122 Conditioncond 57.0% 57 / 100 MC/DCmcdc 4.6% 3 / 64 Subroutinesub 90.8% 99 / 109 Podpod 47.8% 22 / 46 totaltotal 67.5% 476 / 705 CC 104 SCAR 22.4
CC
104
Cov
72%
__ANON__
110.0
__ANON__
20.0
__ANON__
20.0
CRAP 9.4
« 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 183 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 183 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 183 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 183 our $VERSION = '0.07';
9 183 our $AUTHORITY = 'cpan:BRICKPOOL';
10
11 183 ▶use Scalar::Util qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
12 blessed
13 openhandle
14 looks_like_number
15 reftype
16 183 );
17
18 # ----------------------------------------------------------------------
19 # Export type constraints
20 # ----------------------------------------------------------------------
21
22 183 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
23
24 183 our @EXPORT_OK = qw(
25 Maybe
26 InstanceOf
27 );
28
29 183 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 183 my %seen;
112 push
113 @EXPORT_OK,
114 16104 grep {!$seen{$_}++} @{$EXPORT_TAGS{$_}}
115 183 foreach keys %EXPORT_TAGS;
116 push
117 183 @{$EXPORT_TAGS{all}},
118 @EXPORT_OK;
119 }
120
121 # ----------------------------------------------------------------------
122 # Built-in Type::API-compatible type object
123 # ----------------------------------------------------------------------
124 {
125 183 package # hides from CPAN
126 TUI::Type::Object;
127
128 183 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
129 183 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
130
131 183 ▶ use B ();
Subroutine BEGIN: called CC=1 SCAR=0.0
132 183 ▶ use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
133
134 183 my %roles = (
135 'Type::API::Constraint' => 1,
136 'Type::API::Constraint::Constructor' => 1,
137 'Type::API::Constraint::Inlinable' => 1,
138 );
139
140 661 ▶ sub DOES {
Subroutine DOES: called CC=2 SCAR=6.9
141 661 my ( $proto, $role ) = @_;
142 661 ▶ return !!1 if $roles{$role};
Branch: 1 branch
BranchTrueFalseTotal
if $roles{$role} 105 556 661
143 556 return $proto->SUPER::DOES( $role );
144 }
145
146 1533 ▶ sub new {
Subroutine new: called CC=3 SCAR=11.4
147 1533 my ( $class, %spec ) = @_;
148 1533 ▶ die "missing name" unless exists $spec{name};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $spec{"name"} 0 1533 1533
149 1533 ▶ die "missing constraint" unless exists $spec{constraint};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $spec{"constraint"} 0 1533 1533
150 1533 return bless \%spec => $class;
151 }
152
153 3165 ▶ sub check {
Subroutine check: called CC=3 SCAR=11.0
154 3165 my ( $param, $value ) = ( shift, @_ );
155 3165 ▶ if ( $param->{parent} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($param->{"parent"}) 2484 681 3165
156 2484 ▶ return !!0 unless $param->{parent}->check( $value );
Branch: 1 branch
BranchTrueFalseTotal
unless $param->{"parent"}->check($value) 93 2391 2484
157 }
158 3072 local $_ = $value;
159 3072 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 645 ▶ sub can_be_inlined {
Subroutine can_be_inlined: called CC=1 SCAR=0.0
171 645 my $param = shift;
172 645 return ref( $param->{inlined} ) eq 'CODE';
173 }
174
175 1533 ▶ sub inline_check {
Subroutine inline_check: called CC=5 SCAR=18.1
176 1533 my ( $param, $name ) = ( shift, @_ );
177 1533 ▶ return unless defined( $name ) && !ref( $name ) && length( $name );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name and not ref $name and length $name 0 1533 1533
Condition33%2/6
defined $name and not ref $name and length $name
!ll&&!rl&&r
001533
defined $name and not ref $name
!ll&&!rl&&r
001533
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 1533 ▶ return unless ref( $param->{inlined} ) eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $param->{"inlined"} eq "CODE" 7 1526 1533
179 1526 return $param->{inlined}->( $param, $name );
180 }
181
182 621 ▶ 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 4963 ▶ '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 183 fallback => 1;
198
199 }
200
201 # ----------------------------------------------------------------------
202 # Primitive constraints
203 # ----------------------------------------------------------------------
204
205 883 ▶sub is_Any ($) { 1 }
Subroutine is_Any: called CC=1 SCAR=0.0
Pod undocumented
206 677 ▶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 447 ▶sub is_Defined ($) { defined($_[0]) }
Subroutine is_Defined: called CC=1 SCAR=0.0
Pod undocumented
209 229 ▶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] 227 2 229
210 661 ▶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" 661 0 661
211 84 ▶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 80 84
212 67 ▶sub is_Num ($) { looks_like_number($_[0]) }
Subroutine is_Num: called CC=1 SCAR=0.0
Pod undocumented
213 260 ▶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/ 260 0 260
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 104283 ▶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/ 104283 0 104283
216 35536 ▶sub is_Object ($) { blessed($_[0]) }
Subroutine is_Object: called CC=1 SCAR=0.0
Pod undocumented
217
218 # ----------------------------------------------------------------------
219 # Ref constraints
220 # ----------------------------------------------------------------------
221
222 222 ▶sub is_Ref ($) { !!ref($_[0]) }
Subroutine is_Ref: called CC=1 SCAR=0.0
Pod undocumented
223 154 ▶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" 136 18 154
224 99 ▶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 80 ▶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 183 ▶ 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 117 ▶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" 117 0 117
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 183 our %TYPES;
275
276 192 ▶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 14 ▶ inlined => sub { "1" },
Subroutine __ANON__: called CC=1 SCAR=0.0
281 192 ▶ );
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
151770
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 226 ▶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 26 ▶ inlined => sub { "1" },
Subroutine __ANON__: called CC=1 SCAR=0.0
290 226 ▶ );
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
491770
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 612 ▶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 271 ▶ inlined => sub { "defined($_[1])" },
Subroutine __ANON__: called CC=1 SCAR=0.0
308 612 ▶ );
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
4351770
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 197 ▶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 197 ▶ );
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
251720
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 95 ▶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 64 ▶ inlined => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
335 64 "do { local \$_ = $_[1]; defined && ref \\\$_ eq 'SCALAR' }"
336 },
337 95 ▶ );
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
69260
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 193 ▶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 193 ▶ );
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
241690
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 443 ▶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 410 ▶ inlined => sub { "do { local \$_ = $_[1]; defined && /\\A-?\\d+\\z/ }" },
Subroutine __ANON__: called CC=1 SCAR=0.0
365 443 ▶ );
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
2741690
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 35 ▶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 32 ▶ inlined => sub { "do { local \$_ = $_[1]; defined && /\\A\\d+\\z/ }" },
Subroutine __ANON__: called CC=1 SCAR=0.0
385 35 ▶ );
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
20150
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 644 ▶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 623 ▶ inlined => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
394 623 "do { require Scalar::Util; Scalar::Util::blessed($_[1]) }"
395 },
396 644 ▶ );
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
4801640
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 190 ▶ return sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
444 190 my ( $value ) = @_;
445 190 ▶ return !!1 unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 56 134 190
446 134 return $inner->check( $value );
447 41 };
448 },
449 41 );
450 }
451
452 197 ▶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 197 ▶ );
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
291680
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 197 ▶ return $type unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 196 1 197
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 13 ▶sub ScalarRef (;$) {
Subroutine ScalarRef: called CC=3 SCAR=11.1
Pod documented
498 my $type = $TYPES{ScalarRef} ||= TUI::Type::Object->new(
499 name => 'ScalarRef',
500 parent => Ref,
501 constraint => \&is_ScalarRef,
502 5 ▶ inlined => sub { "ref($_[1]) eq 'SCALAR' || ref($_[1]) eq 'REF'" },
Subroutine __ANON__: called CC=1 SCAR=0.0
503 13 ▶ );
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
670
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 13 ▶ return $type unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 6 7 13
505
506 7 my ( $param ) = @_;
507 return _param_type(
508 name => 'ScalarRef',
509 param => $param,
510 parent => $type,
511 7 ▶ constraint_generator => sub {
Subroutine __ANON__: called CC=1 SCAR=0.1
512 7 my ( $inner ) = @_;
513 22 ▶ return sub {
Subroutine __ANON__: called CC=3 SCAR=11.4
514 22 my ( $ref ) = @_;
515 22 ▶ return !!0 unless is_ScalarRef( $ref );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_ScalarRef($ref) 0 22 22
516 22 ▶ return !!0 unless $inner->check( $$ref );
Branch: 1 branch
BranchTrueFalseTotal
unless $inner->check($$ref) 0 22 22
517 22 return !!1;
518 7 };
519 },
520 7 );
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 58 ▶sub _param_type {
Subroutine _param_type: called CC=11 SCAR=26.5
686 58 my ( %args ) = @_;
687 58 my $kind = $args{name};
688 58 my $ref = $args{param};
689 58 my $parent = $args{parent};
690 58 my $builder = $args{constraint_generator};
691
692 # Basic checks
693 58 ▶ Carp::croak "Missing required argument 'name'"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $kind 0 58 58
694 unless defined $kind;
695 58 ▶ Carp::croak "Missing required argument 'param'"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ref 0 58 58
696 unless defined $ref;
697 58 ▶ Carp::croak "Missing required argument 'constraint_generator'"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $builder 0 58 58
698 unless defined $builder;
699
700 # Check argument types
701 58 ▶ Carp::croak "Expects name to be a string"
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Str($kind) 0 58 58
702 unless is_Str( $kind );
703 58 ▶ Carp::croak "Expects constraint_generator to be a code ref"
Branch: 1 branch
BranchTrueFalseTotal
unless &is_CodeRef($builder) 0 58 58
704 unless is_CodeRef( $builder );
705 58 ▶ Carp::croak "Expects param to be an array reference"
Branch: 1 branch
BranchTrueFalseTotal
unless &is_ArrayRef($ref) 0 58 58
706 unless is_ArrayRef( $ref );
707 58 ▶ Carp::croak "Expects param array ref to hold exactly one type"
Branch: 1 branch
BranchTrueFalseTotal
unless @$ref == 1 0 58 58
708 unless @$ref == 1;
709
710 # Check if inner is a Type-API style object
711 58 my ( $inner ) = @$ref;
712 58 ▶ Carp::croak "Expects a type constraint object as inner type"
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($inner) and $inner->can("check") 0 58 58
Condition33%1/3
builtin::blessed($inner) and $inner->can("check")
!ll&&!rl&&r
0058
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 58 ▶ my $a = $inner->{name} || '__ANON__';
Condition50%1/2
$inner->{'name'} || '__ANON__'
l!l
580
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 58 return TUI::Type::Object->new(
719 name => "$kind\[$a\]",
720 parent => $parent,
721 constraint => $builder->( $inner ),
722 );
723 }
724
725 183 1
726
727 __END__
« lib/TUI/Gadgets/MouseDialog.pm ↑ Summary lib/TUI/TextView/TextDevice.pm »