Spore/Meta/Types.pm

filter: Statementstmt 92.0% 23 / 25 Branchbran 33.3% 2 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 8 / 10 Podpod n/a totaltotal 80.4% 33 / 41 CC 4 SCAR 5.7
CC
4
Cov
81%
__ANON__
3.7
__ANON__
2.1
__ANON__
2.1
CRAP 1.8
« Spore/Role.pm ↑ Summary Spore/Meta/Method/Spore.pm »
1 package Net::HTTP::Spore::Meta::Types;
2 31 $Net::HTTP::Spore::Meta::Types::VERSION = '0.09';
3 # ABSTRACT: Moose type definitions for Net::HTTP::Spore
4  
5 31 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 31 ▶use MooseX::Types -declare => [ qw(UriPath Boolean HTTPMethod JSONBoolean) ];
Subroutine BEGIN: called CC=1 SCAR=0.0
7 31 ▶use MooseX::Types::Moose qw(Str Int Defined);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 31 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 subtype UriPath,
11 as Str,
12 129 ▶ where { $_ =~ m!^/! },
Subroutine __ANON__: called CC=1 SCAR=0.0
13 0 ▶ message {"path must start with /"};
Subroutine __ANON__: not called CC=1 SCAR=1.2
14  
15 31 enum HTTPMethod, [qw(OPTIONS HEAD GET POST PUT DELETE TRACE PATCH)];
16  
17 subtype Boolean,
18 as Int,
19 39 ▶ where { $_ eq 1 || $_ eq 0 };
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
$_ eq 1 or $_ eq 0 39 0 39
20  
21 subtype JSONBoolean,
22 as Defined,
23 23 ▶ where { JSON::is_bool($_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
24  
25 coerce Boolean,
26 from JSONBoolean,
27 23 ▶ via { return int($_) ? 1 : 0 },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
int $_ ? : 23 0 23
28 from Str,
29 0 ▶ via { return $_ eq 'true' ? 1 : 0 };
Subroutine __ANON__: not called CC=2 SCAR=13.0
Branch: 1 branch
BranchTrueFalseTotal
$_ eq 'true' ? : 0 0 0
30  
31 31 1;
32  
33 __END__
« Spore/Role.pm ↑ Summary Spore/Meta/Method/Spore.pm »