Silki/Types/Internal.pm

filter: Statementstmt 62.2% 33 / 53 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 38.8% 7 / 18 Podpod n/a totaltotal 44.9% 40 / 89 CC 7 SCAR 28.5
CC
7
Cov
49%
__ANON__
56.0
__ANON__
2.0
__ANON__
2.0
CRAP 17.2
« Silki/Plugin/ErrorHandling.pm ↑ Summary Silki/Markdent/Handler/HTMLGenerator.pm »
1 package Silki::Types::Internal;
2 {
3 8 $Silki::Types::Internal::VERSION = '0.29';
4 }
5  
6 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 8 ▶use Email::Valid;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 8 ▶use MooseX::Types -declare => [
Subroutine BEGIN: called CC=1 SCAR=0.0
11 qw( PosInt
12 PosOrZeroInt
13 NonEmptyStr
14 ErrorForSession
15 URIStr
16 ValidPermissionType
17 Tarball
18 )
19 8 ];
20 8 ▶use MooseX::Types::Moose qw( Int Str Defined );
Subroutine BEGIN: called CC=1 SCAR=0.0
21 8 ▶use MooseX::Types::Path::Class qw( File );
Subroutine BEGIN: called CC=1 SCAR=0.0
22 8 ▶use Path::Class ();
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 subtype PosInt,
25 as Int,
26 0 ▶ where { $_ > 0 },
Subroutine __ANON__: not called CC=1 SCAR=6.9
27 0 ▶ message {'This must be a positive integer'};
Subroutine __ANON__: not called CC=1 SCAR=1.2
28  
29 subtype PosOrZeroInt,
30 as Int,
31 0 ▶ where { $_ >= 0 },
Subroutine __ANON__: not called CC=1 SCAR=6.9
32 0 ▶ message {'This must be an integer >= 0'};
Subroutine __ANON__: not called CC=1 SCAR=1.2
33  
34 subtype NonEmptyStr,
35 as Str,
36 0 ▶ where { length $_ >= 0 },
Subroutine __ANON__: not called CC=1 SCAR=6.9
37 0 ▶ message {'This string must not be empty'};
Subroutine __ANON__: not called CC=1 SCAR=1.2
38  
39 0 ▶subtype ErrorForSession, as Defined, where {
Subroutine __ANON__: not called CC=7 SCAR=40.3
40 0 return 1;
41 0 ▶ return 1 unless ref $_;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $_ 0 0 0
42 0 ▶ return 1 if eval { @{$_} } && !grep {ref} @{$_};
Branch: 1 branch
BranchTrueFalseTotal
if eval { do { @{$_;} } } and not grep({ref $_;} @{$_;}) 0 0 0
Condition0%0/3
eval { do { @{$_;} } } and not grep({ref $_;} @{$_;})
!ll&&!rl&&r
000
MC/DC0%0/2
eval { do { @{$_;} } } and not grep({ref $_;} @{$_;})
eval { do { @{$_;} } } not grep({ref $_;} @{$_;})
Truth table0%0/3
A and not(B)
A= eval { do { @{$_;} } }B= not grep({ref $_;} @{$_;})
ABresult
0X0
100
111
43 0 ▶ return 0 unless blessed $_;
Branch: 1 branch
BranchTrueFalseTotal
unless $_->blessed 0 0 0
44 0 ▶ return 1 if $_->can('messages') || $_->can('message');
Branch: 1 branch
BranchTrueFalseTotal
if $_->can("messages") or $_->can("message") 0 0 0
Condition0%0/3
$_->can("messages") or $_->can("message")
l!l&&r!l&&!r
000
MC/DC0%0/2
$_->can("messages") or $_->can("message")
$_->can("messages") $_->can("message")
Truth table0%0/3
A or B
A= $_->can("messages")B= $_->can("message")
ABresult
1X1
011
000
45 0 return 0;
46 8 };
47  
48 8 subtype URIStr, as NonEmptyStr;
49  
50 0 ▶coerce URIStr, from class_type('URI'), via { $_->canonical() };
Subroutine __ANON__: not called CC=1 SCAR=1.2
51  
52 subtype ValidPermissionType,
53 as NonEmptyStr,
54 0 ▶ where {qr/^(?:public|public-read|private)$/};
Subroutine __ANON__: not called CC=1 SCAR=1.2
55  
56 subtype Tarball,
57 as File,
58 0 ▶ where { $_[0]->basename() =~ /\.(tar|tar\.gz|tgz)/ };
Subroutine __ANON__: not called CC=1 SCAR=1.2
59  
60 coerce Tarball,
61 from Str,
62 0 ▶ via { Path::Class::file($_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
63  
64 8 1;
65  
66 # ABSTRACT: Silki-specific types
67  
68 __END__
« Silki/Plugin/ErrorHandling.pm ↑ Summary Silki/Markdent/Handler/HTMLGenerator.pm »