Common/String.pm

filter: Statementstmt 100% 29 / 29 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 14 / 14 Podpod n/a totaltotal 100% 47 / 47 CC 3 SCAR 2.2
CC
3
Cov
100%
__ANON__
2.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.2
↑ Summary Common.pm »
1 package MouseX::Types::Common::String;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 our $VERSION = '0.001000';
7  
8 2 ▶use MouseX::Types -declare => [
Subroutine BEGIN: called CC=1 SCAR=0.0
9 qw(SimpleStr NonEmptySimpleStr Password StrongPassword NonEmptyStr)
10 2 ];
11  
12 2 ▶use MouseX::Types::Mouse qw/Str/;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 subtype SimpleStr,
15 as Str,
16 10 ▶ where { (length($_) <= 255) && ($_ !~ m/\n/) },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
length $_ <= 255 and not $_ =~ /\n/ 9 1 10
17 2 ▶ message { "Must be a single line of no more than 255 chars" };
Subroutine __ANON__: called CC=1 SCAR=0.0
18  
19 subtype NonEmptySimpleStr,
20 as SimpleStr,
21 6 ▶ where { length($_) > 0 },
Subroutine __ANON__: called CC=1 SCAR=0.0
22 1 ▶ message { "Must be a non-empty single line of no more than 255 chars" };
Subroutine __ANON__: called CC=1 SCAR=0.0
23  
24 # XXX duplicating constraint msges since moose only uses last message
25 subtype Password,
26 as NonEmptySimpleStr,
27 4 ▶ where { length($_) > 3 },
Subroutine __ANON__: called CC=1 SCAR=0.0
28 1 ▶ message { "Must be between 4 and 255 chars" };
Subroutine __ANON__: called CC=1 SCAR=0.0
29  
30 subtype StrongPassword,
31 as Password,
32 2 ▶ where { (length($_) > 7) && (m/[^a-zA-Z]/) },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
length $_ > 7 and /[^a-zA-Z]/ 1 1 2
33 1 ▶ message {"Must be between 8 and 255 chars, and contain a non-alpha char" };
Subroutine __ANON__: called CC=1 SCAR=0.0
34  
35 subtype NonEmptyStr,
36 as Str,
37 4 ▶ where { length($_) > 0 },
Subroutine __ANON__: called CC=1 SCAR=0.0
38 1 ▶ message { "Must not be empty" };
Subroutine __ANON__: called CC=1 SCAR=0.0
39  
40  
41 2 1;
42 __END__
↑ Summary Common.pm »