StackExchange/Types.pm

filter: Statementstmt 74.0% 20 / 27 Branchbran 50.0% 4 / 8 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 66.6% 6 / 9 Podpod n/a totaltotal 55.5% 30 / 54 CC 7 SCAR 17.4
CC
7
Cov
59%
__ANON__
12.0
__ANON__
12.0
__ANON__
2.0
CRAP 5.7
« StackExchange/Answers/Response.pm ↑ Summary StackExchange/Answers/Request.pm »
1 package Net::StackExchange::Types;
2 5 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 $Net::StackExchange::Types::VERSION = '0.102740';
4 }
5  
6 # ABSTRACT: Custom types
7  
8 5 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 subtype 'List::id'
12 => as 'Str'
13 0 ▶ => where { $_ =~ /^(?:\d;?)+$/ };
Subroutine __ANON__: not called CC=1 SCAR=1.2
14  
15 5 subtype 'JSON::XS::Boolean'
16 => as 'JSON::XS::Boolean';
17  
18 5 subtype 'JSON::PP::Boolean'
19 => as 'JSON::PP::Boolean';
20  
21 subtype 'Boolean'
22 => as 'Str'
23 12 ▶ => where { $_ eq 'true' || $_ eq 'false' };
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$_ eq "true" or $_ eq "false" 7 5 12
24  
25 coerce 'Boolean'
26 => from 'JSON::XS::Boolean'
27 0 ▶ => via {
Subroutine __ANON__: not called CC=3 SCAR=24.8
28 0 ▶ if ( JSON::is_bool($_) && $_ == JSON::true ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&JSON::is_bool($_) and $_ == JSON::true()) 0 0 0
Condition0%0/3
&JSON::is_bool($_) and $_ == JSON::true()
!ll&&!rl&&r
000
MC/DC0%0/2
&JSON::is_bool($_) and $_ == JSON::true()
&JSON::is_bool($_) $_ == JSON::true()
Truth table0%0/3
A and B
A= &JSON::is_bool($_)B= $_ == JSON::true()
ABresult
0X0
100
111
29 0 return 'true';
30 }
31 0 return 'false';
32 }
33 => from 'JSON::PP::Boolean'
34 0 ▶ => via {
Subroutine __ANON__: not called CC=3 SCAR=24.8
35 0 ▶ if ( JSON::is_bool($_) && $_ == JSON::true ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&JSON::is_bool($_) and $_ == JSON::true()) 0 0 0
Condition0%0/3
&JSON::is_bool($_) and $_ == JSON::true()
!ll&&!rl&&r
000
MC/DC0%0/2
&JSON::is_bool($_) and $_ == JSON::true()
&JSON::is_bool($_) $_ == JSON::true()
Truth table0%0/3
A and B
A= &JSON::is_bool($_)B= $_ == JSON::true()
ABresult
0X0
100
111
36 0 return 'true';
37 }
38 0 return 'false';
39 }
40 => from 'Int'
41 2 ▶ => via {
Subroutine __ANON__: called CC=2 SCAR=6.9
42 2 ▶ if ($_) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_) 1 1 2
43 1 return 'true';
44 }
45 1 return 'false';
46 5 };
47  
48 5 ▶no Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
49  
50 5 1;
51  
52 __END__
« StackExchange/Answers/Response.pm ↑ Summary StackExchange/Answers/Request.pm »