DRI/Data/Contact/COZA.pm

filter: Statementstmt 44.4% 16 / 36 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 23 MC/DCmcdc 0.0% 0 / 12 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 22.8% 21 / 92 CC 17 SCAR 54.7
CC
17
Cov
22%
validate
306.0
BEGIN
1.0
BEGIN
1.0
CRAP 236.7
« DRI/Protocol/IRIS/DCHK/Domain.pm ↑ Summary DRI/Protocol/EPP/Extensions/ResellerObject.pm »
1 ## Domain Registry Interface, Handling of contact data for .CO.ZA
2 ##
3 ## Copyright (c) 2011 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
4 ##
5 ## This file is part of Net::DRI
6 ##
7 ## Net::DRI is free software; you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation; either version 2 of the License, or
10 ## (at your option) any later version.
11 ##
12 ## See the LICENSE file that comes with this distribution for more details.
13 #########################################################################################
14  
15 package Net::DRI::Data::Contact::COZA;
16  
17 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use base qw(Net::DRI::Data::Contact);
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 ####################################################################################################
26  
27 sub validate ## See http://registry.coza.net.za/doku.php?id=eppcontactconstraints
28 {
29 0 ▶ my ($self,$change)=@_;
Subroutine validate: not called CC=17 SCAR=57.2
Pod undocumented
30 0 ▶ $change||=0;
Condition0%0/2
$change ||= 0
l!l
00
MC/DC0%0/1
$change ||= 0
$change
Truth table0%0/2
A
A= $change
Aresult
11
00
31 0 my @errs;
32  
33 0 $self->SUPER::validate($change); ## will trigger an Exception if problem
34  
35 0 my @rs=($self->street());
36 0 foreach my $i (0,1)
37 {
38 0 ▶ next unless defined $rs[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $rs[$i] 0 0 0
39 0 ▶ push @errs,'street' if ((ref($rs[$i]) ne 'ARRAY') || (@{$rs[$i]} > 3) || (grep { !Net::DRI::Util::xml_is_normalizedstring($_,8,255) } @{$rs[$i]}));
Branch: 1 branch
BranchTrueFalseTotal
if ref $rs[$i] ne "ARRAY" or @{$rs[$i];} > 3 or grep {not Net::DRI::Util::xml_is_normalizedstring($_, 8, 255);} @{$rs[$i];} 0 0 0
Condition0%0/6
ref $rs[$i] ne "ARRAY" or @{$rs[$i];} > 3 or grep {not Net::DRI::Util::xml_is_normalizedstring($_, 8, 255);} @{$rs[$i];}
l!l&&r!l&&!r
000
ref $rs[$i] ne "ARRAY" or @{$rs[$i];} > 3
l!l&&r!l&&!r
000
MC/DC0%0/3
ref $rs[$i] ne "ARRAY" or @{$rs[$i];} > 3 or grep {not Net::DRI::Util::xml_is_normalizedstring($_, 8, 255);} @{$rs[$i];}
ref $rs[$i] ne "ARRAY" @{$rs[$i];} > 3 grep {not Net::DRI::Util::xml_is_normalizedstring($_, 8, 255);} @{$rs[$i];}
Truth table0%0/4
A or B or C
A= ref $rs[$i] ne "ARRAY"B= @{$rs[$i];} > 3C= grep {not Net::DRI::Util::xml_is_normalizedstring($_, 8, 255);} @{$rs[$i];}
ABCresult
1XX1
01X1
0011
0000
40 }
41  
42 0 ▶ push @errs,'city' if ($self->city() && grep { !Net::DRI::Util::xml_is_normalizedstring($_,2,255) } ($self->city()));
Branch: 1 branch
BranchTrueFalseTotal
if $self->city and grep {not Net::DRI::Util::xml_is_normalizedstring($_, 2, 255);} $self->city 0 0 0
Condition0%0/3
$self->city and grep {not Net::DRI::Util::xml_is_normalizedstring($_, 2, 255);} $self->city
!ll&&!rl&&r
000
MC/DC0%0/2
$self->city and grep {not Net::DRI::Util::xml_is_normalizedstring($_, 2, 255);} $self->city
$self->city grep {not Net::DRI::Util::xml_is_normalizedstring($_, 2, 255);} $self->city
Truth table0%0/3
A and B
A= $self->cityB= grep {not Net::DRI::Util::xml_is_normalizedstring($_, 2, 255);} $self->city
ABresult
0X0
100
111
43 0 ▶ push @errs,'sp' if ($self->sp() && grep { !Net::DRI::Util::xml_is_normalizedstring($_,2,255) } ($self->sp()));
Branch: 1 branch
BranchTrueFalseTotal
if $self->sp and grep {not Net::DRI::Util::xml_is_normalizedstring($_, 2, 255);} $self->sp 0 0 0
Condition0%0/3
$self->sp and grep {not Net::DRI::Util::xml_is_normalizedstring($_, 2, 255);} $self->sp
!ll&&!rl&&r
000
MC/DC0%0/2
$self->sp and grep {not Net::DRI::Util::xml_is_normalizedstring($_, 2, 255);} $self->sp
$self->sp grep {not Net::DRI::Util::xml_is_normalizedstring($_, 2, 255);} $self->sp
Truth table0%0/3
A and B
A= $self->spB= grep {not Net::DRI::Util::xml_is_normalizedstring($_, 2, 255);} $self->sp
ABresult
0X0
100
111
44  
45 0 my $ra=$self->auth();
46 0 ▶ push @errs,'auth' if ($ra && (ref($ra) eq 'HASH') && exists($ra->{pw}) && !Net::DRI::Util::xml_is_normalizedstring($ra->{pw}));
Branch: 1 branch
BranchTrueFalseTotal
if $ra and ref $ra eq "HASH" and exists $ra->{"pw"} and not Net::DRI::Util::xml_is_normalizedstring($ra->{"pw"}) 0 0 0
Condition0%0/9
$ra and ref $ra eq "HASH" and exists $ra->{"pw"} and not Net::DRI::Util::xml_is_normalizedstring($ra->{"pw"})
!ll&&!rl&&r
000
$ra and ref $ra eq "HASH" and exists $ra->{"pw"}
!ll&&!rl&&r
000
$ra and ref $ra eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/4
$ra and ref $ra eq "HASH" and exists $ra->{"pw"} and not Net::DRI::Util::xml_is_normalizedstring($ra->{"pw"})
$ra ref $ra eq "HASH" exists $ra->{"pw"} not Net::DRI::Util::xml_is_normalizedstring($ra->{"pw"})
Truth table0%0/5
A and B and C and not(D)
A= $raB= ref $ra eq "HASH"C= exists $ra->{"pw"}D= not Net::DRI::Util::xml_is_normalizedstring($ra->{"pw"})
ABCDresult
0XXX0
10XX0
110X0
11100
11111
47  
48 ## disclose not supported at all
49 0 ▶ push @errs,'disclose' if defined $self->disclose();
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->disclose 0 0 0
50  
51 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
52 0 return 1; ## everything ok.
53 }
54  
55 ####################################################################################################
56 1 1;
57  
58 __END__
59  
60 =pod
61  
62 =head1 NAME
63  
64 Net::DRI::Data::Contact::COZA - Handle CO.ZA contact data for Net::DRI
65  
66 =head1 SYNOPSIS
67  
68 This module is never used directly, it is used by Net::DRI::Protocol::EPP::Extensions::COZA
69  
70 =head1 DESCRIPTION
71  
72 This subclass of Net::DRI::Data::Contact adds validation based on .CO.ZA constraints.
73  
74 =head1 EXAMPLES
75  
76 See L<Net::DRI> documentation.
77  
78 =head1 METHODS
79  
80 This class does not define extra accessors/mutators.
81  
82 =head1 DIAGNOSTICS
83  
84 None.
85  
86 =head1 CONFIGURATION AND ENVIRONMENT
87  
88 None.
89  
90 =head1 DEPENDENCIES
91  
92 This module has to be used inside the Net::DRI framework
93  
94 =head1 INCOMPATIBILITIES
95  
96 None.
97  
98 =head1 BUGS AND LIMITATIONS
99  
100 No known bugs. Please report problems to author (see below) or use CPAN RT system. Patches are welcome.
101  
102 =head1 SUPPORT
103  
104 For now, support questions should be sent to:
105  
106 E<lt>netdri@dotandco.comE<gt>
107  
108 Please also see the SUPPORT file in the distribution.
109  
110 =head1 SEE ALSO
111  
112 http://www.dotandco.com/services/software/Net-DRI/
113  
114 =head1 AUTHOR
115  
116 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
117  
118 =head1 LICENSE AND COPYRIGHT
119  
120 Copyright (c) 2011 Patrick Mevzek <netdri@dotandco.com>.
121 All rights reserved.
122  
123 This program is free software; you can redistribute it and/or modify
124 it under the terms of the GNU General Public License as published by
125 the Free Software Foundation; either version 2 of the License, or
126 (at your option) any later version.
127  
128 See the LICENSE file that comes with this distribution for more details.
129  
130 =cut
« DRI/Protocol/IRIS/DCHK/Domain.pm ↑ Summary DRI/Protocol/EPP/Extensions/ResellerObject.pm »