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 0 ▶{
Subroutine validate: not called CC=17 SCAR=57.2
Pod undocumented
29 0 my ($self,$change)=@_;
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__
« DRI/Protocol/IRIS/DCHK/Domain.pm ↑ Summary DRI/Protocol/EPP/Extensions/ResellerObject.pm »