blib/lib/WWW/LogicBoxes/Types.pm

filter: Statementstmt 80.0% 68 / 85 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 34.6% 9 / 26 Podpod n/a totaltotal 65.2% 77 / 118 CC 3 SCAR 8.5
CC
3
Cov
76%
__ANON__
12.0
__ANON__
2.0
__ANON__
2.0
CRAP 2.3
« Build ↑ Summary blib/lib/WWW/LogicBoxes/DomainRequest/Registration.pm »
1 package WWW::LogicBoxes::Types;
2  
3 76 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 76 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 76 ▶use Data::Validate::Domain qw( is_domain );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 76 ▶use Data::Validate::Email qw( is_email );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 76 ▶use Data::Validate::IP qw( is_ipv4 );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 76 ▶use Data::Validate::URI qw( is_uri );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 76 our $VERSION = '1.1.0'; # VERSION
12 # ABSTRACT: WWW::LogicBoxes Moose Type Library
13  
14 76 use MooseX::Types -declare => [qw(
15 ArrayRef
16 Bool
17 HashRef
18 Int
19 Str
20 Strs
21  
22 ContactType
23 DateTime
24 DomainName
25 DomainNames
26 DomainStatus
27 EmailAddress
28 InvoiceOption
29 IPv4
30 IPv4s
31 Language
32 NexusCategory
33 NexusPurpose
34 NumberPhone
35 Password
36 PhoneNumber
37 ResponseType
38 URI
39 VerificationStatus
40  
41 Contact
42 Customer
43 Domain
44 DomainAvailability
45 DomainAvailabilities
46 DomainRegistration
47 DomainTransfer
48 PrivateNameServer
49 PrivateNameServers
50 76 ▶)];
Subroutine BEGIN: called CC=1 SCAR=0.0
51  
52 use MooseX::Types::Moose
53 76 ArrayRef => { -as => 'MooseArrayRef' },
54 Bool => { -as => 'MooseBool' },
55 HashRef => { -as => 'MooseHashRef' },
56 Int => { -as => 'MooseInt' },
57 76 ▶ Str => { -as => 'MooseStr' };
Subroutine BEGIN: called CC=1 SCAR=0.0
58  
59 76 subtype ArrayRef, as MooseArrayRef;
60 76 subtype Bool, as MooseBool;
61 76 subtype HashRef, as MooseHashRef;
62 76 subtype Int, as MooseInt;
63 76 subtype Str, as MooseStr;
64  
65 76 subtype Strs, as ArrayRef[Str];
66  
67 76 enum ContactType, [qw(
68 Contact
69 AtContact
70 CaContact
71 CnContact
72 CoContact
73 CoopContact
74 DeContact
75 EsContact
76 EuContact
77 NlContact
78 RuContact
79 UkContact
80 )];
81 76 enum DomainStatus, [ 'InActive', 'Active', 'Suspended', 'Pending Delete Restorable', 'Deleted', 'Archived' ];
82 76 enum InvoiceOption, [qw( NoInvoice PayInvoice KeepInvoice )];
83 76 enum Language, [qw( en )];
84 76 enum NexusCategory, [qw( C11 C12 C21 C31 C32 )];
85 76 enum NexusPurpose, [qw( P1 P2 P3 P4 P5 )];
86 76 enum ResponseType, [qw( xml json xml_simple )];
87 76 enum VerificationStatus, [qw( Verified Pending Suspended NA )];
88  
89 76 class_type Contact, { class => 'WWW::LogicBoxes::Contact' };
90 coerce Contact, from HashRef,
91 0 ▶ via { WWW::LogicBoxes::Contact->new( $_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
92  
93 76 class_type Customer, { class => 'WWW::LogicBoxes::Customer' };
94 coerce Customer, from HashRef,
95 0 ▶ via { WWW::LogicBoxes::Customer->new( $_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
96  
97 76 class_type DateTime, { class => 'DateTime' };
98  
99 76 class_type Domain, { class => 'WWW::LogicBoxes::Domain' };
100 coerce Domain, from HashRef,
101 0 ▶ via { WWW::LogicBoxes::Domain->new( $_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
102  
103 76 class_type DomainAvailability, { class => 'WWW::LogicBoxes::DomainAvailability' };
104 76 subtype DomainAvailabilities, as ArrayRef[DomainAvailability];
105  
106 76 class_type DomainRegistration, { class => 'WWW::LogicBoxes::DomainRequest::Registration' };
107 coerce DomainRegistration, from HashRef,
108 0 ▶ via { WWW::LogicBoxes::DomainRequest::Registration->new( $_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
109  
110 76 class_type DomainTransfer, { class => 'WWW::LogicBoxes::DomainRequest::Transfer' };
111 coerce DomainTransfer, from HashRef,
112 0 ▶ via { WWW::LogicBoxes::DomainRequest::Transfer->new( $_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
113  
114 76 class_type NumberPhone, { class => 'Number::Phone' };
115 76 class_type PhoneNumber, { class => 'WWW::LogicBoxes::PhoneNumber' };
116 coerce PhoneNumber, from Str,
117 0 ▶ via { WWW::LogicBoxes::PhoneNumber->new( $_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
118 coerce PhoneNumber, from NumberPhone,
119 0 ▶ via { WWW::LogicBoxes::PhoneNumber->new( $_->format ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
120  
121 76 class_type PrivateNameServer, { class => 'WWW::LogicBoxes::PrivateNameServer' };
122 coerce PrivateNameServer, from HashRef,
123 0 ▶ via { WWW::LogicBoxes::PrivateNameServer->new( $_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
124 76 subtype PrivateNameServers, as ArrayRef[PrivateNameServer];
125  
126 subtype DomainName, as Str,
127 4 ▶ where { is_domain( $_ ) },
Subroutine __ANON__: called CC=1 SCAR=0.0
128 0 ▶ message { "$_ is not a valid domain" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
129 76 subtype DomainNames, as ArrayRef[DomainName];
130  
131 subtype EmailAddress, as Str,
132 0 ▶ where { is_email( $_ ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
133 0 ▶ message { "$_ is not a valid email address" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
134  
135 subtype IPv4, as Str,
136 0 ▶ where { is_ipv4( $_ ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
137 0 ▶ message { "$_ is not a valid ipv4 IP Address" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
138 76 subtype IPv4s, as ArrayRef[IPv4];
139  
140 subtype Password, as Str,
141 where {(
142 0 ▶ $_ =~ m/([a-zA-Z0-9])+/ # Alphanumeric
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 1 branch
BranchTrueFalseTotal
$_ =~ /([a-zA-Z0-9])+/ and length $_ >= 8 and length $_ <= 15 0 0 0
Condition0%0/3
$_ =~ /([a-zA-Z0-9])+/ and length $_ >= 8
!ll&&!rl&&r
000
MC/DC0%0/2
$_ =~ /([a-zA-Z0-9])+/ and length $_ >= 8
$_ =~ /([a-zA-Z0-9])+/ length $_ >= 8
Truth table0%0/3
A and B
A= $_ =~ /([a-zA-Z0-9])+/B= length $_ >= 8
ABresult
0X0
100
111
143 && length($_) >= 8 && length($_) <= 15 # Between 8 and 15 Characters
144 )},
145 0 ▶ message { "$_ is not a valid password. It must be alphanumeric and between 8 and 15 characters" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
146  
147 subtype URI, as Str,
148 0 ▶ where { is_uri( $_ ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
149 0 ▶ message { "$_ is not a valid URI" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
150  
151 76 1;
152  
153 __END__
« Build ↑ Summary blib/lib/WWW/LogicBoxes/DomainRequest/Registration.pm »