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

filter: Statementstmt 16.9% 10 / 59 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.5% 13 / 173 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/CZ/Domain.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,2019 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,2019 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 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
68 0 my ($class,$version)=@_;
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 0 ▶{
Subroutine create: not called CC=19 SCAR=59.4
Pod undocumented
81 0 my ($epp,$domain,$rd)=@_;
82  
83 Net::DRI::Exception::usererr_insufficient_parameters('eligibility attribute is mandatory, as ref hash')
84 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
85  
86 Net::DRI::Exception::usererr_insufficient_parameters('eligibility attribute missing key registrantName')
87 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
88 Net::DRI::Exception::usererr_insufficient_parameters('eligibility attribute missing key policyReason')
89 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
90 Net::DRI::Exception::usererr_insufficient_parameters('eligibility attribute missing key eligibilityType')
91 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
92  
93 0 my @n;
94 0 push @n,['auext:registrantName',$rd->{eligibility}->{registrantName}];
95 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
96 exists $rd->{eligibility}->{registrantIDType} && $rd->{eligibility}->{registrantIDType}) {
97 0 push @n,['auext:registrantID',$rd->{eligibility}->{registrantID},{'type'=> $rd->{eligibility}->{registrantIDType}}];
98 }
99 0 push @n,['auext:eligibilityType',$rd->{eligibility}->{eligibilityType}];
100 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
101 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
102 exists $rd->{eligibility}->{eligibilityIDType} && $rd->{eligibility}->{eligibilityIDType}) {
103 0 push @n,['auext:eligibilityID',$rd->{eligibility}->{eligibilityID},{'type'=> $rd->{eligibility}->{eligibilityIDType}}];
104 }
105 0 push @n,['auext:policyReason',$rd->{eligibility}->{policyReason}];
106  
107 0 $epp->message()->command_extension('auext', ['extensionAU', ['create', @n]]);
108 0 return;
109 }
110  
111  
112 sub info_parse
113 0 ▶{
Subroutine info_parse: not called CC=18 SCAR=58.3
Pod undocumented
114 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
115 0 my $mes=$po->message();
116 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
117  
118 0 my $infdata=$mes->get_extension('auextnew','infData');
119 0 ▶ return unless $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless $infdata 0 0 0
120  
121 0 my %ens;
122 0 my $c=$infdata->getFirstChild();
123 0 ▶ while($c)
Branch: 1 branch
BranchTrueFalseTotal
if ($c) 0 0 0
124 {
125 0 ▶ next unless ($c->nodeType() == 1); ## only for element nodes
Branch: 1 branch
BranchTrueFalseTotal
unless $c->nodeType == 1 0 0 0
126 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
127 0 ▶ next unless $name;
Branch: 1 branch
BranchTrueFalseTotal
unless $name 0 0 0
128  
129 # if ($name eq 'info')
130 0 ▶ if ($name eq 'auProperties')
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "auProperties") 0 0 0
131 {
132 0 my $cc=$c->getFirstChild();
133 0 ▶ while($cc)
Branch: 1 branch
BranchTrueFalseTotal
if ($cc) 0 0 0
134 {
135 0 ▶ next unless ($cc->nodeType() == 1); ## only for element nodes
Branch: 1 branch
BranchTrueFalseTotal
unless $cc->nodeType == 1 0 0 0
136 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
137 0 ▶ next unless $name2;
Branch: 1 branch
BranchTrueFalseTotal
unless $name2 0 0 0
138  
139 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
140 {
141 0 $ens{registrantName}=$cc->getFirstChild()->getData();
142 } elsif ($name2 eq 'registrantID')
143 {
144 0 $ens{registrantID}=$cc->getFirstChild()->getData();
145 0 $ens{registrantIDType}=$cc->getAttribute('type'); #registrantID
146 } elsif ($name2 eq 'eligibilityType')
147 {
148 0 $ens{eligibilityType}=$cc->getFirstChild()->getData();
149 } elsif ($name2 eq 'eligibilityName')
150 {
151 0 $ens{eligibilityName}=$cc->getFirstChild()->getData();
152 } elsif ($name2 eq 'eligibilityID')
153 {
154 0 $ens{eligibilityID}=$cc->getFirstChild()->getData();
155 0 $ens{eligibilityIDType}=$cc->getAttribute('type'); #eligibilityID
156 } elsif ($name2 eq 'policyReason')
157 {
158 0 $ens{policyReason}=$cc->getFirstChild()->getData();
159 }
160 0 } continue { $cc=$cc->getNextSibling(); }
161 }
162 0 } continue { $c=$c->getNextSibling(); }
163  
164 0 $rinfo->{domain}->{$oname}->{eligibility}=\%ens;
165 0 return;
166 }
167 ####################################################################################################
168 1 1;
« DRI/Protocol/EPP/Extensions/PRO/Domain.pm ↑ Summary DRI/Protocol/EPP/Extensions/CZ/Domain.pm »