blib/lib/Pinto/Remote/SelfContained/Types.pm

filter: Statementstmt 100% 31 / 31 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod n/a totaltotal 100% 46 / 46 CC 3 SCAR 2.7
CC
3
Cov
100%
__ANON__
2.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.3
« blib/lib/Pinto/Remote/SelfContained/Action.pm ↑ Summary blib/lib/Pinto/Remote/SelfContained/HasHttptiny.pm »
1 package
2 Pinto::Remote::SelfContained::Types; # hide from PAUSE
3 # ABSTRACT: types for Pinto::Remote::SelfContained
4  
5 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 6 ▶use Type::Utils qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 6 ▶use Types::Standard qw(ArrayRef Dict InstanceOf Optional Str);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 6 our $VERSION = '1.999'; # TRIAL VERSION
12  
13 6 ▶use Type::Library -base, -declare => qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
14 BodyPart
15 Chrome
16 SingleBodyPart
17 Uri
18 Username
19 6 );
20  
21 6 my $BaseBodyPart = declare as Dict[
22 name => Str,
23 data => Optional[Str],
24 filename => Optional[Str | InstanceOf['Path::Tiny']],
25 type => Optional[Str],
26 encoding => Optional[Str],
27 ];
28  
29 declare BodyPart,
30 as $BaseBodyPart,
31 22 ▶ where { defined($_->{data}) != defined($_->{filename}) },
Subroutine __ANON__: called CC=1 SCAR=0.0
32 3 ▶ message { $BaseBodyPart->validate($_) or "A body part needs either data OR a filename" };
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$BaseBodyPart->validate($_) or "A body part needs either data OR a filename" 1 2 3
33  
34 6 class_type Chrome, { class => 'Pinto::Remote::SelfContained::Chrome' };
35  
36 declare SingleBodyPart,
37 as ArrayRef[BodyPart],
38 5 ▶ where { @$_ == 1 },
Subroutine __ANON__: called CC=1 SCAR=0.0
39 3 ▶ message { (ArrayRef[BodyPart])->validate($_) or "Exactly one archive to add is needed" };
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
&ArrayRef([&BodyPart()])->validate($_) or "Exactly one archive to add is needed" 1 2 3
40  
41 6 class_type Uri, { class => 'URI' };
42 13 ▶coerce Uri, from Str, via { require URI; URI->new($_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
43  
44 18 ▶declare Username, as Str, where { /^[^:]+\z/ };
Subroutine __ANON__: called CC=1 SCAR=0.0
45  
46 6 1;
47  
48 __END__
« blib/lib/Pinto/Remote/SelfContained/Action.pm ↑ Summary blib/lib/Pinto/Remote/SelfContained/HasHttptiny.pm »