DRI/Protocol/RRI/Contact.pm

filter: Statementstmt 6.5% 16 / 245 Branchbran 0.0% 0 / 160 Conditioncond 0.0% 0 / 38 MC/DCmcdc 0.0% 0 / 25 Subroutinesub 22.7% 5 / 22 Podpod 0.0% 0 / 16 totaltotal 4.1% 21 / 506 CC 98 SCAR 55.7
CC
98
Cov
4%
info_parse
870.0
_do_locint
132.0
create_parse
110.0
CRAP 263.4
« DRI/Protocol/EPP/Extensions/SecDNS.pm ↑ Summary DRI/Protocol/EPP/Extensions/NO/Domain.pm »
1 ## Domain Registry Interface, RRI Contact commands (DENIC-11)
2 ##
3 ## Copyright (c) 2007,2008,2009 Tonnerre Lombard <tonnerre.lombard@sygroup.ch>. All rights reserved.
4 ## (c) 2012,2013 Michael Holloway <michael@thedarkwinter.com>. All rights reserved.
5 ## (c) 2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
6 ##
7 ## This file is part of Net::DRI
8 ##
9 ## Net::DRI is free software; you can redistribute it and/or modify
10 ## it under the terms of the GNU General Public License as published by
11 ## the Free Software Foundation; either version 2 of the License, or
12 ## (at your option) any later version.
13 ##
14 ## See the LICENSE file that comes with this distribution for more details.
15 ####################################################################################################
16  
17 package Net::DRI::Protocol::RRI::Contact;
18  
19 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 1 ▶use DateTime::Format::ISO8601 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 =pod
28  
29 =head1 NAME
30  
31 Net::DRI::Protocol::RRI::Contact - RRI Contact commands (DENIC-11) for Net::DRI
32  
33 =head1 DESCRIPTION
34  
35 Please see the README file for details.
36  
37 =head1 SUPPORT
38  
39 For now, support questions should be sent to:
40  
41 E<lt>tonnerre.lombard@sygroup.chE<gt>
42  
43 Please also see the SUPPORT file in the distribution.
44  
45 =head1 SEE ALSO
46  
47 E<lt>http://oss.bsdprojects.net/projects/netdri/E<gt>
48  
49 =head1 AUTHOR
50  
51 Tonnerre Lombard, E<lt>tonnerre.lombard@sygroup.chE<gt>
52  
53 =head1 COPYRIGHT
54  
55 Copyright (c) 2007,2008,2009 Tonnerre Lombard <tonnerre.lombard@sygroup.ch>.
56 (c) 2012,2013 Michael Holloway <michael@thedarkwinter.com>. All rights reserved.
57 (c) 2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
58 All rights reserved.
59  
60 This program is free software; you can redistribute it and/or modify
61 it under the terms of the GNU General Public License as published by
62 the Free Software Foundation; either version 2 of the License, or
63 (at your option) any later version.
64  
65 See the LICENSE file that comes with this distribution for more details.
66  
67 =cut
68  
69 ####################################################################################################
70  
71 sub register_commands
72 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
73 0 my ($class,$version)=@_;
74 0 my %tmp=(
75 check => [ \&check, \&check_parse ],
76 info => [ \&info, \&info_parse ],
77 create => [ \&create, \&create_parse ],
78 update => [ \&update ],
79 );
80  
81 ##$tmp{check_multi}=$tmp{check};
82 0 return { 'contact' => \%tmp };
83 }
84  
85 sub build_command
86 0 ▶{
Subroutine build_command: not called CC=9 SCAR=45.0
Pod undocumented
87 0 my ($msg, $command, $contact) = @_;
88 0 ▶ my @contact = (ref($contact) eq 'ARRAY')? @$contact : ($contact);
Branch: 1 branch
BranchTrueFalseTotal
ref $contact eq 'ARRAY' ? : 0 0 0
89 0 ▶ my @c = map { Net::DRI::Util::isa_contact($_)? $_->srid() : $_ }
Branch: 1 branch
BranchTrueFalseTotal
Net::DRI::Util::isa_contact($_) ? : 0 0 0
90 @contact;
91  
92 0 ▶ Net::DRI::Exception->die(1,'protocol/RRI',2,'Contact id needed') unless @c;
Branch: 1 branch
BranchTrueFalseTotal
unless @c 0 0 0
93 0 foreach my $n (@c)
94 {
95 0 ▶ Net::DRI::Exception->die(1,'protocol/RRI',2,'Contact id needed') unless defined($n) && $n;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $n and $n 0 0 0
Condition0%0/3
defined $n and $n
!ll&&!rl&&r
000
MC/DC0%0/2
defined $n and $n
defined $n $n
Truth table0%0/3
A and B
A= defined $nB= $n
ABresult
0X0
100
111
96 0 ▶ Net::DRI::Exception->die(1,'protocol/RRI',10,'Invalid contact id: '.$n) unless Net::DRI::Util::xml_is_token($n,3,32);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::xml_is_token($n, 3, 32) 0 0 0
97 }
98  
99 0 ▶ my $tcommand = (ref($command))? $command->[0] : $command;
Branch: 1 branch
BranchTrueFalseTotal
ref $command ? : 0 0 0
100 0 $msg->command(['contact',$tcommand, $msg->ns('contact')]);
101  
102 0 my @d = map { ['contact:handle',$_] } @c;
103  
104 0 return @d;
105 }
106  
107 ####################################################################################################
108 ########### Query commands
109  
110 sub check
111 0 ▶{
Subroutine check: not called CC=1 SCAR=6.9
Pod undocumented
112 0 my ($rri,$c)=@_;
113 0 my $mes=$rri->message();
114 0 my @d=build_command($mes,'check',$c);
115 0 $mes->command_body(\@d);
116 0 $mes->cltrid(undef);
117 0 return;
118 }
119  
120 sub check_parse
121 0 ▶{
Subroutine check_parse: not called CC=6 SCAR=37.4
Pod undocumented
122 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
123 0 my $mes = $po->message();
124 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
125  
126 0 my $chkdata = $mes->get_content('checkData',$mes->ns('contact'));
127 0 ▶ return unless ($chkdata);
Branch: 1 branch
BranchTrueFalseTotal
unless $chkdata 0 0 0
128 0 my @c = $chkdata->getElementsByTagNameNS($mes->ns('contact'),'handle');
129 0 my @s = $chkdata->getElementsByTagNameNS($mes->ns('contact'),'status');
130 0 ▶ return unless (@c && @s);
Branch: 1 branch
BranchTrueFalseTotal
unless @c and @s 0 0 0
Condition0%0/3
@c and @s
!ll&&!rl&&r
000
MC/DC0%0/2
@c and @s
@c @s
Truth table0%0/3
A and B
A= @cB= @s
ABresult
0X0
100
111
131 0 my $contact = $c[0]->getFirstChild()->getData();
132 0 $rinfo->{contact}->{$contact}->{action} = 'check';
133 0 ▶ $rinfo->{contact}->{$contact}->{exist} = ($s[0]->getFirstChild()->getData() eq 'free')? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$s[0]->getFirstChild->getData eq 'free' ? : 0 0 0
134 0 return;
135 }
136  
137 sub info
138 0 ▶{
Subroutine info: not called CC=1 SCAR=6.9
Pod undocumented
139 0 my ($rri,$c)=@_;
140 0 my $mes=$rri->message();
141 0 my @d=build_command($mes,'info',$c);
142 0 $mes->command_body(\@d);
143 0 $mes->cltrid(undef);
144 0 return;
145 }
146  
147 sub info_parse
148 0 ▶{
Subroutine info_parse: not called CC=29 SCAR=67.7
Pod undocumented
149 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
150 0 my $mes=$po->message();
151 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
152  
153 0 my $infdata=$mes->get_content('infoData',$mes->ns('contact'));
154 0 ▶ return unless $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless $infdata 0 0 0
155  
156 0 my %cd=map { $_ => [] } qw/name org street city sp pc cc/;
157 0 my $contact=$po->create_local_object('contact');
158 0 my @s;
159 0 my $c=$infdata->getFirstChild();
160 0 ▶ while ($c)
Branch: 1 branch
BranchTrueFalseTotal
if ($c) 0 0 0
161 {
162 0 ▶ next unless ($c->nodeType() == 1);
Branch: 1 branch
BranchTrueFalseTotal
unless $c->nodeType == 1 0 0 0
163 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
164 0 ▶ next unless $name;
Branch: 1 branch
BranchTrueFalseTotal
unless $name 0 0 0
165 0 ▶ if ($name eq 'handle')
Branch: 13 branches
BranchTrueFalseTotal
if ($name eq 'handle') { } 0 0 0
elsif ($name eq 'roid') { } 0 0 0
elsif ($name eq 'changed') { } 0 0 0
elsif ($name eq 'type') { } 0 0 0
elsif ($name eq 'email') { } 0 0 0
elsif ($name eq 'name') { } 0 0 0
elsif ($name eq 'organisation') { } 0 0 0
elsif ($name eq 'sip') { } 0 0 0
elsif ($name eq 'remarks') { } 0 0 0
elsif ($name eq 'phone') { } 0 0 0
elsif ($name eq 'fax') { } 0 0 0
elsif ($name eq 'postal') { } 0 0 0
elsif ($name eq 'disclose') { } 0 0 0
166 {
167 0 my $clID;
168 0 $oname = $c->getFirstChild()->getData();
169 0 ▶ if ($oname =~ /^(\w+)-(\d+)-/)
Branch: 1 branch
BranchTrueFalseTotal
if ($oname =~ /^(\w+)-(\d+)-/) 0 0 0
170 0 { $clID = $1 . '-' . $2 . '-RRI'; }
171 0 $rinfo->{contact}->{$oname}->{action} = 'info';
172 0 $rinfo->{contact}->{$oname}->{exist} = 1;
173 $rinfo->{contact}->{$oname}->{clID} =
174 0 $rinfo->{contact}->{$oname}->{crID} = $clID;
175 0 $contact->srid($oname);
176 } elsif ($name eq 'roid')
177 {
178 0 my $el = $c->getFirstChild();
179 0 ▶ $contact->roid($el->getData()) if (defined($el));
Branch: 1 branch
BranchTrueFalseTotal
if defined $el 0 0 0
180 0 $rinfo->{contact}->{$oname}->{roid} = $contact->roid();
181 } elsif ($name eq 'changed')
182 {
183 0 my $el = $c->getFirstChild();
184 $rinfo->{contact}->{$oname}->{upDate} =
185 $rinfo->{contact}->{$oname}->{crDate} =
186 0 ▶ DateTime::Format::ISO8601->new()->
Branch: 1 branch
BranchTrueFalseTotal
if defined $el 0 0 0
187 parse_datetime($c->getFirstChild()->getData()) if (defined($el));
188 } elsif ($name eq 'type')
189 {
190 0 my $el = $c->getFirstChild();
191 0 ▶ $contact->type($el->getData()) if (defined($el));
Branch: 1 branch
BranchTrueFalseTotal
if defined $el 0 0 0
192 } elsif ($name eq 'email')
193 {
194 0 my $el = $c->getFirstChild();
195 0 ▶ $contact->email($el->getData()) if (defined($el));
Branch: 1 branch
BranchTrueFalseTotal
if defined $el 0 0 0
196 } elsif ($name eq 'name')
197 {
198 0 my $el = $c->getFirstChild();
199 0 ▶ $contact->name($el->getData()) if (defined($el));
Branch: 1 branch
BranchTrueFalseTotal
if defined $el 0 0 0
200 } elsif ($name eq 'organisation')
201 {
202 0 my $el = $c->getFirstChild();
203 0 ▶ $contact->org($el->getData()) if (defined($el));
Branch: 1 branch
BranchTrueFalseTotal
if defined $el 0 0 0
204 } elsif ($name eq 'sip')
205 {
206 0 my $el = $c->getFirstChild();
207 0 ▶ $contact->sip($el->getData()) if (defined($el));
Branch: 1 branch
BranchTrueFalseTotal
if defined $el 0 0 0
208 } elsif ($name eq 'remarks')
209 {
210 0 my $el = $c->getFirstChild();
211 0 ▶ $contact->remarks($el->getData()) if (defined($el));
Branch: 1 branch
BranchTrueFalseTotal
if defined $el 0 0 0
212 } elsif ($name eq 'phone')
213 {
214 0 $contact->voice(parse_tel($c));
215 } elsif ($name eq 'fax')
216 {
217 0 $contact->fax(parse_tel($c));
218 } elsif ($name eq 'postal')
219 {
220 0 parse_postalinfo($c,\%cd);
221 } elsif ($name eq 'disclose')
222 {
223 0 $contact->disclose(parse_disclose($c));
224 }
225 0 } continue { $c=$c->getNextSibling(); }
226  
227 0 $contact->street(@{$cd{street}});
228 0 $contact->city(@{$cd{city}});
229 0 $contact->pc(@{$cd{pc}});
230 0 $contact->cc(@{$cd{cc}});
231  
232 0 $rinfo->{contact}->{$oname}->{self}=$contact;
233 0 return;
234 }
235  
236 sub parse_tel
237 0 ▶{
Subroutine parse_tel: not called CC=3 SCAR=24.8
Pod undocumented
238 0 my $node=shift;
239 0 ▶ my $ext=$node->getAttribute('x') || '';
Condition0%0/2
$node->getAttribute('x') || ''
l!l
00
MC/DC0%0/1
$node->getAttribute('x') || ''
$node->getAttribute('x')
Truth table0%0/2
A
A= $node->getAttribute('x')
Aresult
11
00
240 0 my $num=get_data($node);
241 0 ▶ $num.='x'.$ext if $ext;
Branch: 1 branch
BranchTrueFalseTotal
if $ext 0 0 0
242 0 return $num;
243 }
244  
245 sub get_data
246 0 ▶{
Subroutine get_data: not called CC=2 SCAR=17.9
Pod undocumented
247 0 my $n=shift;
248 0 ▶ return ($n->getFirstChild())? $n->getFirstChild()->getData() : '';
Branch: 1 branch
BranchTrueFalseTotal
$n->getFirstChild ? : 0 0 0
249 }
250  
251 sub parse_postalinfo
252 0 ▶{
Subroutine parse_postalinfo: not called CC=9 SCAR=45.0
Pod undocumented
253 0 my ($c,$rcd)=@_;
254 0 my @street;
255 0 my $n = $c->getFirstChild();
256  
257 0 ▶ while ($n)
Branch: 1 branch
BranchTrueFalseTotal
if ($n) 0 0 0
258 {
259 0 ▶ next unless ($n->nodeType() == 1);
Branch: 1 branch
BranchTrueFalseTotal
unless $n->nodeType == 1 0 0 0
260 0 ▶ my $name=$n->localname() || $n->nodeName();
Condition0%0/3
$n->localname || $n->nodeName
l!l&&r!l&&!r
000
MC/DC0%0/2
$n->localname || $n->nodeName
$n->localname $n->nodeName
Truth table0%0/3
A || B
A= $n->localnameB= $n->nodeName
ABresult
1X1
011
000
261 0 ▶ next unless $name;
Branch: 1 branch
BranchTrueFalseTotal
unless $name 0 0 0
262 0 ▶ if ($name eq 'city')
Branch: 4 branches
BranchTrueFalseTotal
if ($name eq 'city') { } 0 0 0
elsif ($name eq 'postalCode') { } 0 0 0
elsif ($name eq 'countryCode') { } 0 0 0
elsif ($name eq 'address') { } 0 0 0
263 {
264 0 $rcd->{city}->[0] = get_data($n);
265 } elsif ($name eq 'postalCode')
266 {
267 0 $rcd->{pc}->[0] = get_data($n);
268 } elsif ($name eq 'countryCode')
269 {
270 0 $rcd->{cc}->[0] = get_data($n);
271 } elsif ($name eq 'address')
272 {
273 0 push @street, get_data($n);
274 }
275 0 } continue { $n=$n->getNextSibling(); }
276  
277 0 $rcd->{street}->[0]=\@street;
278 0 return;
279 }
280  
281 sub parse_disclose
282 0 ▶{
Subroutine parse_disclose: not called CC=7 SCAR=40.3
Pod undocumented
283 0 my $c=shift;
284 0 my $flag=Net::DRI::Util::xml_parse_boolean($c->getAttribute('flag'));
285 0 my %tmp;
286 0 my $n=$c->getFirstChild();
287 0 ▶ while($n)
Branch: 1 branch
BranchTrueFalseTotal
if ($n) 0 0 0
288 {
289 0 ▶ next unless ($n->nodeType() == 1);
Branch: 1 branch
BranchTrueFalseTotal
unless $n->nodeType == 1 0 0 0
290 0 ▶ my $name=$n->localname() || $n->nodeName();
Condition0%0/3
$n->localname || $n->nodeName
l!l&&r!l&&!r
000
MC/DC0%0/2
$n->localname || $n->nodeName
$n->localname $n->nodeName
Truth table0%0/3
A || B
A= $n->localnameB= $n->nodeName
ABresult
1X1
011
000
291 0 ▶ next unless $name;
Branch: 1 branch
BranchTrueFalseTotal
unless $name 0 0 0
292 0 ▶ if ($name=~m/^(name|org|addr)$/)
Branch: 2 branches
BranchTrueFalseTotal
if ($name =~ /^(name|org|addr)$/) { } 0 0 0
elsif ($name =~ /^(voice|fax|email)$/) { } 0 0 0
293 {
294 0 my $t=$n->getAttribute('type');
295 0 $tmp{$1.'_'.$t}=$flag;
296 } elsif ($name=~m/^(voice|fax|email)$/)
297 {
298 0 $tmp{$1}=$flag;
299 }
300 0 } continue { $n=$n->getNextSibling(); }
301 0 return \%tmp;
302 }
303  
304 ############ Transform commands
305  
306 sub build_tel
307 0 ▶{
Subroutine build_tel: not called CC=2 SCAR=17.9
Pod undocumented
308 0 my ($name,$tel)=@_;
309 0 ▶ if ($tel=~m/^(\S+)x(\S+)$/)
Branch: 1 branch
BranchTrueFalseTotal
if ($tel =~ /^(\S+)x(\S+)$/) { } 0 0 0
310 {
311 0 return [$name,$1,{x=>$2}];
312 } else
313 {
314 0 return [$name,$tel];
315 }
316 }
317  
318 sub build_disclose
319 0 ▶{
Subroutine build_disclose: not called CC=7 SCAR=40.3
Pod undocumented
320 0 my $contact=shift;
321 0 my $ref = shift;
322 0 my @d = @$ref;
323 0 my $ds=$contact->disclose();
324 0 ▶ return () unless ($ds && ref($ds));
Branch: 1 branch
BranchTrueFalseTotal
unless $ds and ref $ds 0 0 0
Condition0%0/3
$ds and ref $ds
!ll&&!rl&&r
000
MC/DC0%0/2
$ds and ref $ds
$ds ref $ds
Truth table0%0/3
A and B
A= $dsB= ref $ds
ABresult
0X0
100
111
325 0 foreach (@d) {
326 0 my ($c,$key) = split /:/, @{$_}[0];
327 0 ▶ $key = 'voice' if $key eq 'phone';
Branch: 1 branch
BranchTrueFalseTotal
if $key eq "phone" 0 0 0
328 0 ▶ push @{$_}, { disclose => 'true'} if (defined($ds->{$key}) && $ds->{$key}==1);
Branch: 1 branch
BranchTrueFalseTotal
if defined $ds->{$key} and $ds->{$key} == 1 0 0 0
Condition0%0/3
defined $ds->{$key} and $ds->{$key} == 1
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ds->{$key} and $ds->{$key} == 1
defined $ds->{$key} $ds->{$key} == 1
Truth table0%0/3
A and B
A= defined $ds->{$key}B= $ds->{$key} == 1
ABresult
0X0
100
111
329 }
330 0 return;
331 }
332  
333 sub build_cdata
334 0 ▶{
Subroutine build_cdata: not called CC=8 SCAR=42.8
Pod undocumented
335 0 my $contact=shift;
336 0 my @d;
337  
338 0 my (@post,@addr);
339 0 _do_locint(\@post,$contact,'type','type');
340 0 _do_locint(\@post,$contact,'name','name');
341 0 _do_locint(\@post,$contact,'organisation','org');
342 0 _do_locint(\@addr,$contact,'address','street');
343 0 _do_locint(\@addr,$contact,'postalCode','pc');
344 0 _do_locint(\@addr,$contact,'city','city');
345 0 _do_locint(\@addr,$contact,'countryCode','cc');
346 0 ▶ push @post,['contact:postal',@addr] if @addr;
Branch: 1 branch
BranchTrueFalseTotal
if @addr 0 0 0
347  
348 0 ▶ push (@d,@post) if @post;
Branch: 1 branch
BranchTrueFalseTotal
if @post 0 0 0
349  
350 0 ▶ push @d,build_tel('contact:phone',$contact->voice()) if defined($contact->voice());
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->voice 0 0 0
351 0 ▶ push @d,build_tel('contact:fax',$contact->fax()) if defined($contact->fax());
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->fax 0 0 0
352 0 ▶ push @d,['contact:email',$contact->email()] if defined($contact->email());
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->email 0 0 0
353 0 ▶ push @d,['contact:sip',$contact->sip()] if defined($contact->sip());
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->sip 0 0 0
354 0 ▶ push @d,['contact:remarks', $contact->remarks()] if defined($contact->remarks());
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->remarks 0 0 0
355 0 build_disclose($contact,\@d);
356  
357 0 return @d;
358 }
359  
360 sub _do_locint
361 0 ▶{
Subroutine _do_locint: not called CC=11 SCAR=48.8
362 0 my ($r, $contact, $tagname, $what) = @_;
363 0 my @tmp = $contact->$what();
364 0 my $loaded = 0;
365 0 ▶ return unless (@tmp);
Branch: 1 branch
BranchTrueFalseTotal
unless @tmp 0 0 0
366 0 ▶ if ($what eq 'street')
Branch: 1 branch
BranchTrueFalseTotal
if ($what eq 'street') { } 0 0 0
367 {
368 0 ▶ if (defined($tmp[0]))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $tmp[0]) 0 0 0
369 {
370 0 foreach (@{$tmp[0]})
371 {
372 0 push @$r,['contact:'.$tagname,$_];
373 0 $loaded = 1;
374 }
375 }
376 0 ▶ if (defined($tmp[1]) && !$loaded)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $tmp[1] and not $loaded) 0 0 0
Condition0%0/3
defined $tmp[1] and not $loaded
!ll&&!rl&&r
000
MC/DC0%0/2
defined $tmp[1] and not $loaded
defined $tmp[1] not $loaded
Truth table0%0/3
A and not(B)
A= defined $tmp[1]B= not $loaded
ABresult
0X0
100
111
377 {
378 0 foreach (@{$tmp[1]})
379 {
380 0 push @$r,['contact:'.$tagname,$_];
381 }
382 }
383 } else
384 {
385 0 ▶ if (defined($tmp[0]))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $tmp[0]) 0 0 0
386 {
387 0 push @$r,['contact:'.$tagname,$tmp[0]];
388 0 $loaded = 1;
389 }
390 0 ▶ if (defined($tmp[1]) && !$loaded)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $tmp[1] and not $loaded) 0 0 0
Condition0%0/3
defined $tmp[1] and not $loaded
!ll&&!rl&&r
000
MC/DC0%0/2
defined $tmp[1] and not $loaded
defined $tmp[1] not $loaded
Truth table0%0/3
A and not(B)
A= defined $tmp[1]B= not $loaded
ABresult
0X0
100
111
391 {
392 0 push @$r,['contact:'.$tagname,$tmp[1]];
393 }
394 }
395 0 return;
396 }
397  
398 sub create
399 0 ▶{
Subroutine create: not called CC=2 SCAR=17.9
Pod undocumented
400 0 my ($rri,$contact)=@_;
401 0 my $mes=$rri->message();
402 0 my @d=build_command($mes,'create',$contact);
403  
404 0 ▶ Net::DRI::Exception->die(1,'protocol/RRI',10,'Invalid contact '.$contact) unless (Net::DRI::Util::isa_contact($contact));
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($contact) 0 0 0
405 0 $contact->validate(); ## will trigger an Exception if needed
406 0 push @d,build_cdata($contact);
407 0 $mes->command_body(\@d);
408 0 return;
409 }
410  
411 sub create_parse
412 0 ▶{
Subroutine create_parse: not called CC=10 SCAR=47.0
Pod undocumented
413 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
414 0 my $mes=$po->message();
415 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
416  
417 0 my $credata=$mes->get_content('creData',$mes->ns('contact'));
418 0 ▶ return unless $credata;
Branch: 1 branch
BranchTrueFalseTotal
unless $credata 0 0 0
419  
420 0 my $c=$credata->getFirstChild();
421 0 ▶ while ($c)
Branch: 1 branch
BranchTrueFalseTotal
if ($c) 0 0 0
422 {
423 0 ▶ next unless ($c->nodeType() == 1); ## only for element nodes
Branch: 1 branch
BranchTrueFalseTotal
unless $c->nodeType == 1 0 0 0
424 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
425 0 ▶ if ($name eq 'id')
Branch: 2 branches
BranchTrueFalseTotal
if ($name eq 'id') { } 0 0 0
elsif ($name =~ /^(crDate)$/) { } 0 0 0
426 {
427 0 my $new=$c->getFirstChild()->getData();
428 0 ▶ $rinfo->{contact}->{$oname}->{id}=$new if (defined($oname) && ($oname ne $new)); ## registry may give another id than the one we requested or not take ours into account at all !
Branch: 1 branch
BranchTrueFalseTotal
if defined $oname and $oname ne $new 0 0 0
Condition0%0/3
defined $oname and $oname ne $new
!ll&&!rl&&r
000
MC/DC0%0/2
defined $oname and $oname ne $new
defined $oname $oname ne $new
Truth table0%0/3
A and B
A= defined $onameB= $oname ne $new
ABresult
0X0
100
111
429 0 $oname=$new;
430 0 $rinfo->{contact}->{$oname}->{id}=$oname;
431 0 $rinfo->{contact}->{$oname}->{action}='create';
432 0 $rinfo->{contact}->{$oname}->{exist}=1;
433 } elsif ($name=~m/^(crDate)$/)
434 {
435 0 $rinfo->{contact}->{$oname}->{$1}=DateTime::Format::ISO8601->new()->parse_datetime($c->getFirstChild()->getData());
436 }
437 0 } continue { $c=$c->getNextSibling(); }
438 0 return;
439 }
440  
441 sub update
442 0 ▶{
Subroutine update: not called CC=6 SCAR=37.4
Pod undocumented
443 0 my ($rri,$contact,$todo)=@_;
444 0 my $mes=$rri->message();
445  
446 0 ▶ Net::DRI::Exception::usererr_invalid_parameters($todo.' must be a 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
447 0 ▶ if ((grep { ! /^(?:add|del)$/ } $todo->types('status')) ||
Branch: 1 branch
BranchTrueFalseTotal
if (grep {not /^(?:add|del)$/;} $todo->types("status") or grep {not /^(?:set)$/;} $todo->types("info")) 0 0 0
Condition0%0/3
grep {not /^(?:add|del)$/;} $todo->types("status") or grep {not /^(?:set)$/;} $todo->types("info")
l!l&&r!l&&!r
000
MC/DC0%0/2
grep {not /^(?:add|del)$/;} $todo->types("status") or grep {not /^(?:set)$/;} $todo->types("info")
grep {not /^(?:add|del)$/;} $todo->types("status") grep {not /^(?:set)$/;} $todo->types("info")
Truth table0%0/3
A or B
A= grep {not /^(?:add|del)$/;} $todo->types("status")B= grep {not /^(?:set)$/;} $todo->types("info")
ABresult
1X1
011
000
448 0 (grep { ! /^(?:set)$/ } $todo->types('info'))
449 )
450 {
451 0 Net::DRI::Exception->die(0,'protocol/RRI',11,'Only status add/del or info set available for contact');
452 }
453  
454 0 my @d=build_command($mes,'update',$contact);
455  
456 0 my $newc=$todo->set('info');
457 0 ▶ if ($newc)
Branch: 1 branch
BranchTrueFalseTotal
if ($newc) 0 0 0
458 {
459 0 ▶ Net::DRI::Exception->die(1,'protocol/RRI',10,'Invalid contact '.$newc) unless Net::DRI::Util::isa_contact($newc);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($newc) 0 0 0
460 0 $newc->type($contact->type());
461 0 $newc->validate(1); ## will trigger an Exception if needed
462 0 push @d,build_cdata($newc);
463 }
464 0 $mes->command_body(\@d);
465 0 return;
466 }
467  
468 ####################################################################################################
469 1 1;
« DRI/Protocol/EPP/Extensions/SecDNS.pm ↑ Summary DRI/Protocol/EPP/Extensions/NO/Domain.pm »