DRI/Protocol/EPP/Extensions/AU/Domain.pm

filter: Statementstmt 15.8% 10 / 63 Branchbran 0.0% 0 / 44 Conditioncond 0.0% 0 / 39 MC/DCmcdc 0.0% 0 / 22 Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 3 totaltotal 7.3% 13 / 177 CC 36 SCAR 57.9
CC
36
Cov
7%
create
380.0
info_parse
342.0
register_commands
2.0
CRAP 326.4
« DRI/Protocol/EPP/Extensions/PRO/Domain.pm ↑ Summary DRI/Protocol/EPP/Extensions/SecDNS.pm »
1 ## Domain Registry Interface, .AU Domain EPP extension commands
2 ##
3 ## Copyright (c) 2007,2008,2013 Distribute.IT Pty Ltd, www.distributeit.com.au, Rony Meyer <perl@spot-light.ch>. All rights reserved.
4 ## Copyright (c) 2016 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
5 ##
6 ## This file is part of Net::DRI
7 ##
8 ## Net::DRI is free software; you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation; either version 2 of the License, or
11 ## (at your option) any later version.
12 ##
13 ## See the LICENSE file that comes with this distribution for more details.
14 ####################################################################################################
15  
16 package Net::DRI::Protocol::EPP::Extensions::AU::Domain;
17  
18 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 =pod
24  
25 =head1 NAME
26  
27 Net::DRI::Protocol::EPP::Extensions::AU::Domain - .AU EPP Domain extension commands for Net::DRI
28  
29 =head1 DESCRIPTION
30  
31 Please see the README file for details.
32  
33 =head1 SUPPORT
34  
35 For now, support questions should be sent to:
36  
37 E<lt>netdri@dotandco.comE<gt>
38  
39 Please also see the SUPPORT file in the distribution.
40  
41 =head1 SEE ALSO
42  
43 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
44  
45 =head1 AUTHOR
46  
47 Rony Meyer, E<lt>perl@spot-light.chE<gt>
48  
49 =head1 COPYRIGHT
50  
51 Copyright (c) 2007,2008,2013 Distribute.IT Pty Ltd, E<lt>http://www.distributeit.com.auE<gt>, Rony Meyer <perl@spot-light.ch>.
52 Copyright (c) 2016 Patrick Mevzek <netdri@dotandco.com>.
53 All rights reserved.
54  
55 This program is free software; you can redistribute it and/or modify
56 it under the terms of the GNU General Public License as published by
57 the Free Software Foundation; either version 2 of the License, or
58 (at your option) any later version.
59  
60 See the LICENSE file that comes with this distribution for more details.
61  
62 =cut
63  
64 ####################################################################################################
65  
66 sub register_commands
67 {
68 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
69 0 my %tmp=(
70 create => [ \&create, undef ],
71 info => [ undef, \&info_parse ],
72 );
73  
74 0 return { 'domain' => \%tmp };
75 }
76  
77 ####################################################################################################
78  
79 sub create
80 {
81 0 ▶ my ($epp,$domain,$rd)=@_;
Subroutine create: not called CC=19 SCAR=59.4
Pod undocumented
82 0 my $mes=$epp->message();
83  
84 Net::DRI::Exception::usererr_insufficient_parameters('eligibility attribute is mandatory, as ref hash')
85 0 ▶ unless (exists($rd->{eligibility}) && (ref($rd->{eligibility}) eq 'HASH'));
Branch: 1 branch
BranchTrueFalseTotal
unless exists $rd->{"eligibility"} and ref $rd->{"eligibility"} eq "HASH" 0 0 0
Condition0%0/3
exists $rd->{"eligibility"} and ref $rd->{"eligibility"} eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
exists $rd->{"eligibility"} and ref $rd->{"eligibility"} eq "HASH"
exists $rd->{"eligibility"} ref $rd->{"eligibility"} eq "HASH"
Truth table0%0/3
A and B
A= exists $rd->{"eligibility"}B= ref $rd->{"eligibility"} eq "HASH"
ABresult
0X0
100
111
86  
87 Net::DRI::Exception::usererr_insufficient_parameters('eligibility attribute missing key registrantName')
88 0 ▶ unless (exists($rd->{eligibility}->{registrantName}) && $rd->{eligibility}->{registrantName});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $rd->{"eligibility"}{"registrantName"} and $rd->{"eligibility"}{"registrantName"} 0 0 0
Condition0%0/3
exists $rd->{"eligibility"}{"registrantName"} and $rd->{"eligibility"}{"registrantName"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $rd->{"eligibility"}{"registrantName"} and $rd->{"eligibility"}{"registrantName"}
exists $rd->{"eligibility"}{"registrantName"} $rd->{"eligibility"}{"registrantName"}
Truth table0%0/3
A and B
A= exists $rd->{"eligibility"}{"registrantName"}B= $rd->{"eligibility"}{"registrantName"}
ABresult
0X0
100
111
89 Net::DRI::Exception::usererr_insufficient_parameters('eligibility attribute missing key policyReason')
90 0 ▶ unless (exists($rd->{eligibility}->{policyReason}) && $rd->{eligibility}->{policyReason});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $rd->{"eligibility"}{"policyReason"} and $rd->{"eligibility"}{"policyReason"} 0 0 0
Condition0%0/3
exists $rd->{"eligibility"}{"policyReason"} and $rd->{"eligibility"}{"policyReason"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $rd->{"eligibility"}{"policyReason"} and $rd->{"eligibility"}{"policyReason"}
exists $rd->{"eligibility"}{"policyReason"} $rd->{"eligibility"}{"policyReason"}
Truth table0%0/3
A and B
A= exists $rd->{"eligibility"}{"policyReason"}B= $rd->{"eligibility"}{"policyReason"}
ABresult
0X0
100
111
91 Net::DRI::Exception::usererr_insufficient_parameters('eligibility attribute missing key eligibilityType')
92 0 ▶ unless (exists($rd->{eligibility}->{eligibilityType}) && $rd->{eligibility}->{eligibilityType});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $rd->{"eligibility"}{"eligibilityType"} and $rd->{"eligibility"}{"eligibilityType"} 0 0 0
Condition0%0/3
exists $rd->{"eligibility"}{"eligibilityType"} and $rd->{"eligibility"}{"eligibilityType"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $rd->{"eligibility"}{"eligibilityType"} and $rd->{"eligibility"}{"eligibilityType"}
exists $rd->{"eligibility"}{"eligibilityType"} $rd->{"eligibility"}{"eligibilityType"}
Truth table0%0/3
A and B
A= exists $rd->{"eligibility"}{"eligibilityType"}B= $rd->{"eligibility"}{"eligibilityType"}
ABresult
0X0
100
111
93  
94 0 my @n;
95 0 push @n,['auext:registrantName',$rd->{eligibility}->{registrantName}];
96 0 ▶ if (exists $rd->{eligibility}->{registrantID} && $rd->{eligibility}->{registrantID} &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rd->{"eligibility"}{"registrantID"} and $rd->{"eligibility"}{"registrantID"} and exists $rd->{"eligibility"}{"registrantIDType"} and $rd->{"eligibility"}{"registrantIDType"}) 0 0 0
Condition0%0/9
exists $rd->{"eligibility"}{"registrantID"} and $rd->{"eligibility"}{"registrantID"} and exists $rd->{"eligibility"}{"registrantIDType"} and $rd->{"eligibility"}{"registrantIDType"}
!ll&&!rl&&r
000
exists $rd->{"eligibility"}{"registrantID"} and $rd->{"eligibility"}{"registrantID"} and exists $rd->{"eligibility"}{"registrantIDType"}
!ll&&!rl&&r
000
exists $rd->{"eligibility"}{"registrantID"} and $rd->{"eligibility"}{"registrantID"}
!ll&&!rl&&r
000
MC/DC0%0/4
exists $rd->{"eligibility"}{"registrantID"} and $rd->{"eligibility"}{"registrantID"} and exists $rd->{"eligibility"}{"registrantIDType"} and $rd->{"eligibility"}{"registrantIDType"}
exists $rd->{"eligibility"}{"registrantID"} $rd->{"eligibility"}{"registrantID"} exists $rd->{"eligibility"}{"registrantIDType"} $rd->{"eligibility"}{"registrantIDType"}
Truth table0%0/5
A and B and C and D
A= exists $rd->{"eligibility"}{"registrantID"}B= $rd->{"eligibility"}{"registrantID"}C= exists $rd->{"eligibility"}{"registrantIDType"}D= $rd->{"eligibility"}{"registrantIDType"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
97 exists $rd->{eligibility}->{registrantIDType} && $rd->{eligibility}->{registrantIDType}) {
98 0 push @n,['auext:registrantID',$rd->{eligibility}->{registrantID},{'type'=> $rd->{eligibility}->{registrantIDType}}];
99 }
100 0 push @n,['auext:eligibilityType',$rd->{eligibility}->{eligibilityType}];
101 0 ▶ push @n,['auext:eligibilityName',$rd->{eligibility}->{eligibilityName}] if exists $rd->{eligibility}->{eligibilityName} && $rd->{eligibility}->{eligibilityName};
Branch: 1 branch
BranchTrueFalseTotal
if exists $rd->{"eligibility"}{"eligibilityName"} and $rd->{"eligibility"}{"eligibilityName"} 0 0 0
Condition0%0/3
exists $rd->{"eligibility"}{"eligibilityName"} and $rd->{"eligibility"}{"eligibilityName"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $rd->{"eligibility"}{"eligibilityName"} and $rd->{"eligibility"}{"eligibilityName"}
exists $rd->{"eligibility"}{"eligibilityName"} $rd->{"eligibility"}{"eligibilityName"}
Truth table0%0/3
A and B
A= exists $rd->{"eligibility"}{"eligibilityName"}B= $rd->{"eligibility"}{"eligibilityName"}
ABresult
0X0
100
111
102 0 ▶ if (exists $rd->{eligibility}->{eligibilityID} && $rd->{eligibility}->{eligibilityID} &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rd->{"eligibility"}{"eligibilityID"} and $rd->{"eligibility"}{"eligibilityID"} and exists $rd->{"eligibility"}{"eligibilityIDType"} and $rd->{"eligibility"}{"eligibilityIDType"}) 0 0 0
Condition0%0/9
exists $rd->{"eligibility"}{"eligibilityID"} and $rd->{"eligibility"}{"eligibilityID"} and exists $rd->{"eligibility"}{"eligibilityIDType"} and $rd->{"eligibility"}{"eligibilityIDType"}
!ll&&!rl&&r
000
exists $rd->{"eligibility"}{"eligibilityID"} and $rd->{"eligibility"}{"eligibilityID"} and exists $rd->{"eligibility"}{"eligibilityIDType"}
!ll&&!rl&&r
000
exists $rd->{"eligibility"}{"eligibilityID"} and $rd->{"eligibility"}{"eligibilityID"}
!ll&&!rl&&r
000
MC/DC0%0/4
exists $rd->{"eligibility"}{"eligibilityID"} and $rd->{"eligibility"}{"eligibilityID"} and exists $rd->{"eligibility"}{"eligibilityIDType"} and $rd->{"eligibility"}{"eligibilityIDType"}
exists $rd->{"eligibility"}{"eligibilityID"} $rd->{"eligibility"}{"eligibilityID"} exists $rd->{"eligibility"}{"eligibilityIDType"} $rd->{"eligibility"}{"eligibilityIDType"}
Truth table0%0/5
A and B and C and D
A= exists $rd->{"eligibility"}{"eligibilityID"}B= $rd->{"eligibility"}{"eligibilityID"}C= exists $rd->{"eligibility"}{"eligibilityIDType"}D= $rd->{"eligibility"}{"eligibilityIDType"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
103 exists $rd->{eligibility}->{eligibilityIDType} && $rd->{eligibility}->{eligibilityIDType}) {
104 0 push @n,['auext:eligibilityID',$rd->{eligibility}->{eligibilityID},{'type'=> $rd->{eligibility}->{eligibilityIDType}}];
105 }
106 0 push @n,['auext:policyReason',$rd->{eligibility}->{policyReason}];
107  
108 0 my $eid=$mes->command_extension_register('auext', 'extensionAU');
109  
110 0 my @nn;
111 0 push @nn, ['auext:create',@n];
112  
113 0 $mes->command_extension($eid,\@nn);
114 0 return;
115 }
116  
117  
118 sub info_parse
119 {
120 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=18 SCAR=58.3
Pod undocumented
121 0 my $mes=$po->message();
122 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
123  
124 0 my $infdata=$mes->get_extension('auextnew','infData');
125 0 ▶ return unless $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless $infdata 0 0 0
126  
127 0 my %ens;
128 0 my $c=$infdata->getFirstChild();
129 0 ▶ while($c)
Branch: 1 branch
BranchTrueFalseTotal
if ($c) 0 0 0
130 {
131 0 ▶ next unless ($c->nodeType() == 1); ## only for element nodes
Branch: 1 branch
BranchTrueFalseTotal
unless $c->nodeType == 1 0 0 0
132 0 ▶ my $name=$c->localname() || $c->nodeName();
Condition0%0/3
$c->localname || $c->nodeName
l!l&&r!l&&!r
000
MC/DC0%0/2
$c->localname || $c->nodeName
$c->localname $c->nodeName
Truth table0%0/3
A || B
A= $c->localnameB= $c->nodeName
ABresult
1X1
011
000
133 0 ▶ next unless $name;
Branch: 1 branch
BranchTrueFalseTotal
unless $name 0 0 0
134  
135 # if ($name eq 'info')
136 0 ▶ if ($name eq 'auProperties')
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "auProperties") 0 0 0
137 {
138 0 my $cc=$c->getFirstChild();
139 0 ▶ while($cc)
Branch: 1 branch
BranchTrueFalseTotal
if ($cc) 0 0 0
140 {
141 0 ▶ next unless ($cc->nodeType() == 1); ## only for element nodes
Branch: 1 branch
BranchTrueFalseTotal
unless $cc->nodeType == 1 0 0 0
142 0 ▶ my $name2=$cc->localname() || $cc->nodeName();
Condition0%0/3
$cc->localname || $cc->nodeName
l!l&&r!l&&!r
000
MC/DC0%0/2
$cc->localname || $cc->nodeName
$cc->localname $cc->nodeName
Truth table0%0/3
A || B
A= $cc->localnameB= $cc->nodeName
ABresult
1X1
011
000
143 0 ▶ next unless $name2;
Branch: 1 branch
BranchTrueFalseTotal
unless $name2 0 0 0
144  
145 0 ▶ if ($name2 eq 'registrantName')
Branch: 6 branches
BranchTrueFalseTotal
if ($name2 eq 'registrantName') { } 0 0 0
elsif ($name2 eq 'registrantID') { } 0 0 0
elsif ($name2 eq 'eligibilityType') { } 0 0 0
elsif ($name2 eq 'eligibilityName') { } 0 0 0
elsif ($name2 eq 'eligibilityID') { } 0 0 0
elsif ($name2 eq 'policyReason') { } 0 0 0
146 {
147 0 $ens{registrantName}=$cc->getFirstChild()->getData();
148 } elsif ($name2 eq 'registrantID')
149 {
150 0 $ens{registrantID}=$cc->getFirstChild()->getData();
151 0 $ens{registrantIDType}=$cc->getAttribute('type'); #registrantID
152 } elsif ($name2 eq 'eligibilityType')
153 {
154 0 $ens{eligibilityType}=$cc->getFirstChild()->getData();
155 } elsif ($name2 eq 'eligibilityName')
156 {
157 0 $ens{eligibilityName}=$cc->getFirstChild()->getData();
158 } elsif ($name2 eq 'eligibilityID')
159 {
160 0 $ens{eligibilityID}=$cc->getFirstChild()->getData();
161 0 $ens{eligibilityIDType}=$cc->getAttribute('type'); #eligibilityID
162 } elsif ($name2 eq 'policyReason')
163 {
164 0 $ens{policyReason}=$cc->getFirstChild()->getData();
165 }
166 0 } continue { $cc=$cc->getNextSibling(); }
167 }
168 0 } continue { $c=$c->getNextSibling(); }
169  
170 0 $rinfo->{domain}->{$oname}->{eligibility}=\%ens;
171 0 return;
172 }
173 ####################################################################################################
174 1 1;
« DRI/Protocol/EPP/Extensions/PRO/Domain.pm ↑ Summary DRI/Protocol/EPP/Extensions/SecDNS.pm »