DRI/Protocol/EPP/Extensions/TCI/Registrar.pm

filter: Statementstmt 14.4% 16 / 111 Branchbran 0.0% 0 / 52 Conditioncond 0.0% 0 / 16 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 55.5% 5 / 9 Podpod 0.0% 0 / 4 totaltotal 10.5% 21 / 200 CC 44 SCAR 61.9
CC
44
Cov
9%
info_parse
702.0
update
380.0
register_commands
2.0
CRAP 490.0
« DRI/Data/Contact/CIRA.pm ↑ Summary DRI/Data/Contact/EURid.pm »
1 ## Domain Registry Interface, .RU/.SU/.XN--P1AI EPP REgistrar Extension for Net::DRI
2 ##
3 ## Copyright (c) 2010-2011 Dmitry Belyavsky <beldmit@gmail.com>
4 ## 2011-2014,2018 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::TCI::Registrar;
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::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use DateTime::Format::ISO8601;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 ####################################################################################################
26  
27 sub register_commands
28 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
29 0 my ($class,$version)=@_;
30 0 my %tmp=(
31 update => [ \&update, ],
32 info => [ \&info, \&info_parse ],
33 );
34  
35 0 return { 'registrar' => \%tmp };
36 }
37  
38 ####################################################################################################
39  
40 sub update
41 0 ▶{
Subroutine update: not called CC=19 SCAR=59.4
Pod undocumented
42 0 my ($epp,$registrar,$todo)=@_;
43 0 my $mes=$epp->message();
44  
45 0 ▶ Net::DRI::Exception::usererr_invalid_parameters($todo.' must be a non empty Net::DRI::Data::Changes object') unless Net::DRI::Util::isa_changes($todo);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_changes($todo) 0 0 0
46  
47 0 my $ip_add=$todo->add('ip');
48 0 my $ip_del=$todo->del('ip');
49  
50 0 my $email_add=$todo->add('email');
51 0 my $email_del=$todo->del('email');
52  
53 0 my @d;
54 0 push @d, ['registrar:id', $registrar];
55 0 my (@add,@del);
56 0 ▶ if ($email_add)
Branch: 1 branch
BranchTrueFalseTotal
if ($email_add) 0 0 0
57 {
58 0 foreach my $key (sort { $a cmp $b } keys %$email_add)
59 {
60 0 my @emails = @{$email_add->{$key}};
61  
62 0 foreach my $email (@emails)
63 {
64 0 push @add, ['registrar:email', $email, {'type' => $key}];
65 }
66 }
67 }
68 0 ▶ if ($ip_add)
Branch: 1 branch
BranchTrueFalseTotal
if ($ip_add) 0 0 0
69 {
70 0 foreach my $ip (@$ip_add)
71 {
72 0 push @add, ['registrar:addr', $ip, {'ip' => 'v4'}];
73 }
74 }
75  
76 0 ▶ if ($email_del)
Branch: 1 branch
BranchTrueFalseTotal
if ($email_del) 0 0 0
77 {
78 0 foreach my $key (sort { $a cmp $b } keys %$email_del)
79 {
80 0 my @emails = @{$email_add->{$key}};
81  
82 0 foreach my $email (@emails)
83 {
84 0 push @del, ['registrar:email', $email, {'type' => $key}];
85 }
86 }
87 }
88  
89 0 ▶ if ($ip_del)
Branch: 1 branch
BranchTrueFalseTotal
if ($ip_del) 0 0 0
90 {
91 0 foreach my $ip (@$ip_del)
92 {
93 0 push @del, ['registrar:addr', $ip, {'ip' => 'v4'}];
94 }
95 }
96  
97 $mes->command(
98 0 ['update','registrar:update',sprintf('xmlns:registrar="%s"',$mes->nsattrs('registrar')),]
99 );
100 0 ▶ push @d,['registrar:add',@add] if @add;
Branch: 1 branch
BranchTrueFalseTotal
if @add 0 0 0
101 0 ▶ push @d,['registrar:rem',@del] if @del;
Branch: 1 branch
BranchTrueFalseTotal
if @del 0 0 0
102  
103 0 my @chg;
104 0 my $chg = $todo->set('voice');
105 0 for my $str (@$chg)
106 {
107 0 push @chg,['registrar:voice',$str];
108 }
109
110 0 $chg = $todo->set('fax');
111 0 for my $str (@$chg)
112 {
113 0 push @chg,['registrar:fax',$str];
114 }
115  
116 0 $chg=$todo->set('www');
117 0 ▶ push @chg,['registrar:www',$chg] if $chg;
Branch: 1 branch
BranchTrueFalseTotal
if $chg 0 0 0
118
119 0 $chg = $todo->set('whois');
120 0 ▶ push @chg,['registrar:whois',$chg] if $chg;
Branch: 1 branch
BranchTrueFalseTotal
if $chg 0 0 0
121  
122 0 ▶ push @d,['registrar:chg',@chg] if @chg;
Branch: 1 branch
BranchTrueFalseTotal
if @chg 0 0 0
123  
124 0 $mes->command_body(\@d);
125 0 return;
126 }
127  
128 sub info
129 0 ▶{
Subroutine info: not called CC=1 SCAR=6.9
Pod undocumented
130 0 my ($epp,$registrar,$rd)=@_;
131  
132 0 my $mes=$epp->message();
133  
134 0 $mes->command(
135 ['info','registrar:info',sprintf('xmlns:registrar="%s"',$mes->nsattrs('registrar')),]
136 );
137 0 $mes->command_body(['registrar:id', $registrar]);
138 0 return;
139 }
140  
141 sub info_parse
142 0 ▶{
Subroutine info_parse: not called CC=26 SCAR=65.5
Pod undocumented
143 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
144 0 my $mes=$po->message();
145 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
146  
147 0 my $infdata=$mes->get_response("registrar", "infData");
148 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
149  
150 0 foreach my $el (Net::DRI::Util::xml_list_children($infdata))
151 {
152 0 my ($name,$c)=@$el;
153  
154 0 ▶ if($name eq 'id')
Branch: 14 branches
BranchTrueFalseTotal
if ($name eq 'id') { } 0 0 0
elsif ($name eq 'status') { } 0 0 0
elsif ($name eq 'intPostalInfo') { } 0 0 0
elsif ($name eq 'locPostalInfo') { } 0 0 0
elsif ($name eq 'legalInfo') { } 0 0 0
elsif ($name eq 'taxpayerNumbers') { } 0 0 0
elsif ($name eq 'voice') { } 0 0 0
elsif ($name eq 'fax') { } 0 0 0
elsif ($name eq 'email') { } 0 0 0
elsif ($name eq 'www') { } 0 0 0
elsif ($name eq 'whois') { } 0 0 0
elsif ($name eq 'addr') { } 0 0 0
elsif ($name eq 'crDate') { } 0 0 0
elsif ($name eq 'upDate') { } 0 0 0
155 {
156 0 $rinfo->{registrar}->{info}->{id} = $c->textContent();
157 }
158 elsif($name eq 'status')
159 {
160 0 ▶ $rinfo->{registrar}->{info}->{status} ||= [];
Condition0%0/2
$rinfo->{"registrar"}{"info"}{"status"} ||= []
l!l
00
MC/DC0%0/1
$rinfo->{"registrar"}{"info"}{"status"} ||= []
$rinfo->{"registrar"}{"info"}{"status"}
Truth table0%0/2
A
A= $rinfo->{"registrar"}{"info"}{"status"}
Aresult
11
00
161 0 push @{$rinfo->{registrar}->{info}->{status}}, $c->textContent();
162 }
163 elsif($name eq 'intPostalInfo')
164 {
165 0 ▶ $rinfo->{registrar}->{info}->{intPostalInfo} ||= [];
Condition0%0/2
$rinfo->{"registrar"}{"info"}{"intPostalInfo"} ||= []
l!l
00
MC/DC0%0/1
$rinfo->{"registrar"}{"info"}{"intPostalInfo"} ||= []
$rinfo->{"registrar"}{"info"}{"intPostalInfo"}
Truth table0%0/2
A
A= $rinfo->{"registrar"}{"info"}{"intPostalInfo"}
Aresult
11
00
166 0 push @{$rinfo->{registrar}->{info}->{intPostalInfo}}, $c->textContent();
167 }
168 elsif($name eq 'locPostalInfo')
169 {
170 0 ▶ $rinfo->{registrar}->{info}->{locPostalInfo} ||= [];
Condition0%0/2
$rinfo->{"registrar"}{"info"}{"locPostalInfo"} ||= []
l!l
00
MC/DC0%0/1
$rinfo->{"registrar"}{"info"}{"locPostalInfo"} ||= []
$rinfo->{"registrar"}{"info"}{"locPostalInfo"}
Truth table0%0/2
A
A= $rinfo->{"registrar"}{"info"}{"locPostalInfo"}
Aresult
11
00
171 0 push @{$rinfo->{registrar}->{info}->{locPostalInfo}}, $c->textContent();
172 }
173 elsif($name eq 'legalInfo')
174 {
175 0 ▶ $rinfo->{registrar}->{info}->{legalInfo} ||= [];
Condition0%0/2
$rinfo->{"registrar"}{"info"}{"legalInfo"} ||= []
l!l
00
MC/DC0%0/1
$rinfo->{"registrar"}{"info"}{"legalInfo"} ||= []
$rinfo->{"registrar"}{"info"}{"legalInfo"}
Truth table0%0/2
A
A= $rinfo->{"registrar"}{"info"}{"legalInfo"}
Aresult
11
00
176 0 push @{$rinfo->{registrar}->{info}->{legalInfo}}, $c->textContent();
177 }
178 elsif($name eq 'taxpayerNumbers')
179 {
180 0 $rinfo->{registrar}->{info}->{taxpayerNumbers} = $c->textContent();
181 }
182 elsif($name eq 'voice')
183 {
184 0 ▶ $rinfo->{registrar}->{info}->{voice} ||= [];
Condition0%0/2
$rinfo->{"registrar"}{"info"}{"voice"} ||= []
l!l
00
MC/DC0%0/1
$rinfo->{"registrar"}{"info"}{"voice"} ||= []
$rinfo->{"registrar"}{"info"}{"voice"}
Truth table0%0/2
A
A= $rinfo->{"registrar"}{"info"}{"voice"}
Aresult
11
00
185 0 push @{$rinfo->{registrar}->{info}->{voice}}, $c->textContent();
186 }
187 elsif($name eq 'fax')
188 {
189 0 ▶ $rinfo->{registrar}->{info}->{fax} ||= [];
Condition0%0/2
$rinfo->{"registrar"}{"info"}{"fax"} ||= []
l!l
00
MC/DC0%0/1
$rinfo->{"registrar"}{"info"}{"fax"} ||= []
$rinfo->{"registrar"}{"info"}{"fax"}
Truth table0%0/2
A
A= $rinfo->{"registrar"}{"info"}{"fax"}
Aresult
11
00
190 0 push @{$rinfo->{registrar}->{info}->{fax}}, $c->textContent();
191 }
192 elsif($name eq 'email')
193 {
194 0 my $email_type = $c->getAttribute( "type" );
195 0 ▶ $rinfo->{registrar}->{info}->{email}{$email_type} ||= [];
Condition0%0/2
$rinfo->{"registrar"}{"info"}{"email"}{$email_type} ||= []
l!l
00
MC/DC0%0/1
$rinfo->{"registrar"}{"info"}{"email"}{$email_type} ||= []
$rinfo->{"registrar"}{"info"}{"email"}{$email_type}
Truth table0%0/2
A
A= $rinfo->{"registrar"}{"info"}{"email"}{$email_type}
Aresult
11
00
196 0 push @{$rinfo->{registrar}->{info}->{email}{$email_type}}, $c->textContent();
197 }
198 elsif($name eq 'www')
199 {
200 0 $rinfo->{registrar}->{info}->{www} = $c->textContent();
201 }
202 elsif($name eq 'whois')
203 {
204 0 $rinfo->{registrar}->{info}->{whois} = $c->textContent();
205 }
206 elsif($name eq 'addr')
207 {
208 0 ▶ $rinfo->{registrar}->{info}->{addr} ||= [];
Condition0%0/2
$rinfo->{"registrar"}{"info"}{"addr"} ||= []
l!l
00
MC/DC0%0/1
$rinfo->{"registrar"}{"info"}{"addr"} ||= []
$rinfo->{"registrar"}{"info"}{"addr"}
Truth table0%0/2
A
A= $rinfo->{"registrar"}{"info"}{"addr"}
Aresult
11
00
209 0 push @{$rinfo->{registrar}->{info}->{addr}}, $c->textContent();
210 }
211 elsif($name eq 'crDate')
212 {
213 0 $rinfo->{registrar}->{info}->{crDate} = DateTime::Format::ISO8601->new()->parse_datetime($c->textContent());
214 }
215 elsif($name eq 'upDate')
216 {
217 0 $rinfo->{registrar}->{info}->{upDate} = DateTime::Format::ISO8601->new()->parse_datetime($c->textContent());
218 }
219 }
220 0 return;
221 }
222  
223 ####################################################################################################
224 1 1;
225  
226 =pod
227  
228 =head1 NAME
229  
230 Net::DRI::Protocol::EPP::Extensions::TCI::Registrar - TCI EPP Registrar Extension for Net::DRI
231  
232 =head1 DESCRIPTION
233  
234 Please see the README file for details.
235  
236 =head1 SUPPORT
237  
238 For now, support questions should be sent to:
239  
240 E<lt>netdri@dotandco.comE<gt>
241  
242 Please also see the SUPPORT file in the distribution.
243  
244 =head1 SEE ALSO
245  
246 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
247  
248 =head1 AUTHOR
249  
250 Dmitry Belyavsky, E<lt>beldmit@gmail.comE<gt>
251 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
252  
253 =head1 COPYRIGHT
254  
255 Copyright (c) 2010-2011 Dmitry Belyavsky <beldmit@gmail.com>
256 Copyright (c) 2011-2014,2018 Patrick Mevzek <netdri@dotandco.com>.
257 All rights reserved.
258  
259 This program is free software; you can redistribute it and/or modify
260 it under the terms of the GNU General Public License as published by
261 the Free Software Foundation; either version 2 of the License, or
262 (at your option) any later version.
263  
264 See the LICENSE file that comes with this distribution for more details.
265  
266 =cut
« DRI/Data/Contact/CIRA.pm ↑ Summary DRI/Data/Contact/EURid.pm »