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

filter: Statementstmt 9.5% 19 / 199 Branchbran 0.0% 0 / 104 Conditioncond 0.0% 0 / 47 MC/DCmcdc 0.0% 0 / 25 Subroutinesub 31.5% 6 / 19 Podpod 0.0% 0 / 12 totaltotal 6.1% 25 / 406 CC 79 SCAR 49.4
CC
79
Cov
5%
build_command
272.0
info_parse
182.0
build_cdata
182.0
CRAP 139.3
« DRI/Protocol/EPP/Extensions/ChangePoll.pm ↑ Summary DRI/DRD/NORID.pm »
1 ## Domain Registry Interface, .RU/.SU/.XN--P1AI EPP Contact Extension for Net::DRI
2 ##
3 ## Copyright (c) 2010-2011 Dmitry Belyavsky <beldmit@gmail.com>
4 ## 2011-2013,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::Contact;
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 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use Net::DRI::Protocol::EPP::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 1 ▶use Net::DRI::Protocol::EPP::Core::Contact;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 ####################################################################################################
27  
28 sub register_commands
29 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
30 0 my ($class, $version) = @_;
31 0 my %tmp = (
32 create => [ \&create, \&create_parse ],
33 update => [ \&update, undef ],
34 info => [ \&info, \&info_parse ],
35 );
36  
37 0 return { 'contact' => \%tmp };
38 }
39  
40 ####################################################################################################
41  
42 sub build_command
43 0 ▶{
Subroutine build_command: not called CC=16 SCAR=56.1
Pod undocumented
44 0 my ($msg, $command, $contact) = @_;
45 0 ▶ my @contact = (ref($contact) eq 'ARRAY')? @$contact : ($contact);
Branch: 1 branch
BranchTrueFalseTotal
ref $contact eq 'ARRAY' ? : 0 0 0
46 0 ▶ my @c = map { Net::DRI::Util::isa_contact($_) ?
Branch: 1 branch
BranchTrueFalseTotal
Net::DRI::Util::isa_contact($_) ? : 0 0 0
47 $_->srid() : $_ } @contact;
48  
49 0 ▶ Net::DRI::Exception->die(1,'protocol/EPP',2,'Contact id needed')
Branch: 1 branch
BranchTrueFalseTotal
unless @c 0 0 0
50 unless @c;
51 0 foreach my $n (@c)
52 {
53 0 ▶ Net::DRI::Exception->die(1, 'protocol/EPP', 2,
Branch: 1 branch
BranchTrueFalseTotal
unless defined $n and $n and not ref $n 0 0 0
Condition0%0/6
defined $n and $n and not ref $n
!ll&&!rl&&r
000
defined $n and $n
!ll&&!rl&&r
000
MC/DC0%0/3
defined $n and $n and not ref $n
defined $n $n not ref $n
Truth table0%0/4
A and B and not(C)
A= defined $nB= $nC= not ref $n
ABCresult
0XX0
10X0
1100
1111
54 'Contact id needed') unless (defined($n) && $n && !ref($n));
55 0 ▶ Net::DRI::Exception->die(1, 'protocol/EPP', 10,
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::xml_is_token($n, 3, 32) 0 0 0
56 'Invalid contact id: ' . $n)
57 unless Net::DRI::Util::xml_is_token($n, 3, 32);
58 }
59  
60 0 ▶ my $tcommand = (ref($command)) ? $command->[0] : $command;
Branch: 1 branch
BranchTrueFalseTotal
ref $command ? : 0 0 0
61 0 $msg->command([$command, 'contact:' . $tcommand,
62 sprintf('xmlns:contact="%s"',$msg->nsattrs('contact'))]);
63  
64 0 my @d = map { ['contact:id', $_] } @c;
65 0 ▶ if (($tcommand =~ m/^(?:info|transfer)$/) && ref($contact[0]) &&
Branch: 1 branch
BranchTrueFalseTotal
if ($tcommand =~ /^(?:info|transfer)$/ and ref $contact[0] and Net::DRI::Util::isa_contact($contact[0])) 0 0 0
Condition0%0/6
$tcommand =~ /^(?:info|transfer)$/ and ref $contact[0] and Net::DRI::Util::isa_contact($contact[0])
!ll&&!rl&&r
000
$tcommand =~ /^(?:info|transfer)$/ and ref $contact[0]
!ll&&!rl&&r
000
MC/DC0%0/3
$tcommand =~ /^(?:info|transfer)$/ and ref $contact[0] and Net::DRI::Util::isa_contact($contact[0])
$tcommand =~ /^(?:info|transfer)$/ ref $contact[0] Net::DRI::Util::isa_contact($contact[0])
Truth table0%0/4
A and B and C
A= $tcommand =~ /^(?:info|transfer)$/B= ref $contact[0]C= Net::DRI::Util::isa_contact($contact[0])
ABCresult
0XX0
10X0
1100
1111
66 Net::DRI::Util::isa_contact($contact[0]))
67 {
68 0 my $az = $contact[0]->auth();
69 0 ▶ if ($az && ref($az) && exists($az->{pw}))
Branch: 1 branch
BranchTrueFalseTotal
if ($az and ref $az and exists $az->{"pw"}) 0 0 0
Condition0%0/6
$az and ref $az and exists $az->{"pw"}
!ll&&!rl&&r
000
$az and ref $az
!ll&&!rl&&r
000
MC/DC0%0/3
$az and ref $az and exists $az->{"pw"}
$az ref $az exists $az->{"pw"}
Truth table0%0/4
A and B and C
A= $azB= ref $azC= exists $az->{"pw"}
ABCresult
0XX0
10X0
1100
1111
70 {
71 0 push(@d, ['contact:authInfo', $az->{pw}]);
72 }
73 }
74  
75 0 return @d;
76 }
77  
78 ############ Query commands
79 sub info
80 0 ▶{
Subroutine info: not called CC=1 SCAR=6.9
Pod undocumented
81 0 my ($epp,$c)=@_;
82 0 my $mes=$epp->message();
83 0 my @d=build_command($mes,'info',$c);
84 0 $mes->command_body(\@d);
85 0 return;
86 }
87  
88 sub info_parse
89 0 ▶{
Subroutine info_parse: not called CC=13 SCAR=52.0
Pod undocumented
90 0 my ($po, $otype, $oaction, $oname, $rinfo) = @_;
91 0 my $mes = $po->message();
92 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
93  
94 0 my $infdata = $mes->get_response('contact','infData');
95 0 ▶ return unless $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless $infdata 0 0 0
96  
97 0 my $contact=$po->create_local_object('contact');
98 0 my @s;
99  
100 0 foreach my $el (Net::DRI::Util::xml_list_children($infdata))
101 {
102 0 my ($name,$c)=@$el;
103 0 ▶ if ($name eq 'id')
Branch: 9 branches
BranchTrueFalseTotal
if ($name eq 'id') { } 0 0 0
elsif ($name eq 'roid') { } 0 0 0
elsif ($name eq 'status') { } 0 0 0
elsif ($name =~ /^(clID|crID|upID)$/) { } 0 0 0
elsif ($name =~ /^(crDate|upDate|trDate)$/) { } 0 0 0
elsif ($name eq 'person') { } 0 0 0
elsif ($name eq 'organization') { } 0 0 0
elsif ($name eq 'verified') { } 0 0 0
elsif ($name eq 'unverified') { } 0 0 0
104 {
105 0 $oname=$c->textContent();
106 0 $rinfo->{contact}->{$oname}->{action}='info';
107 0 $rinfo->{contact}->{$oname}->{exist}=1;
108 0 $rinfo->{contact}->{$oname}->{id}=$oname;
109 0 $contact->srid($oname);
110 } elsif ($name eq 'roid')
111 {
112 0 $contact->roid($c->textContent());
113 0 $rinfo->{contact}->{$oname}->{roid}=$contact->roid();
114 } elsif ($name eq 'status')
115 {
116 0 push @s,Net::DRI::Protocol::EPP::Util::parse_status($c);
117 } elsif ($name=~m/^(clID|crID|upID)$/)
118 {
119 0 $rinfo->{contact}->{$oname}->{$1}=$c->textContent();
120 } elsif ($name=~m/^(crDate|upDate|trDate)$/)
121 {
122 0 $rinfo->{contact}->{$oname}->{$1}=$po->parse_iso8601($c->textContent());
123 } elsif ($name eq 'person')
124 {
125 0 $contact->person(parse_contact_data($c));
126 } elsif ($name eq 'organization')
127 {
128 0 $contact->organization(parse_contact_data($c));
129 } elsif ($name eq 'verified')
130 {
131 0 $contact->verified(1);
132 } elsif ($name eq 'unverified')
133 {
134 0 $contact->unverified(1);
135 }
136 else
137 {
138 0 warn "Unspecified behaviour for tag $name"
139 }
140 }
141  
142 0 $rinfo->{contact}->{$oname}->{status}=$po->create_local_object('status')->add(@s);
143 0 $rinfo->{contact}->{$oname}->{self}=$contact;
144 0 return;
145 }
146  
147 sub parse_contact_data
148 0 ▶{
Subroutine parse_contact_data: not called CC=12 SCAR=50.5
Pod undocumented
149 0 my $element = shift;
150 0 my $result = {};
151  
152 0 foreach my $el (Net::DRI::Util::xml_list_children($element))
153 {
154 0 my ($name,$c)=@$el;
155 0 ▶ if (($name eq 'email') || ($name eq 'fax') || ($name eq 'voice') || ($name eq 'passport'))
Branch: 4 branches
BranchTrueFalseTotal
if ($name eq 'email' or $name eq 'fax' or $name eq 'voice' or $name eq 'passport') { } 0 0 0
elsif ($name eq 'taxpayerNumbers' or $name eq 'birthday') { } 0 0 0
elsif ($name eq 'intPostalInfo' or $name eq 'locPostalInfo' or $name eq 'legalInfo') { } 0 0 0
elsif ($name eq 'disclose') { } 0 0 0
Condition0%0/9
$name eq "email" or $name eq "fax" or $name eq "voice" or $name eq "passport"
l!l&&r!l&&!r
000
$name eq "email" or $name eq "fax" or $name eq "voice"
l!l&&r!l&&!r
000
$name eq "email" or $name eq "fax"
l!l&&r!l&&!r
000
MC/DC0%0/4
$name eq "email" or $name eq "fax" or $name eq "voice" or $name eq "passport"
$name eq "email" $name eq "fax" $name eq "voice" $name eq "passport"
Truth table0%0/5
A or B or C or D
A= $name eq "email"B= $name eq "fax"C= $name eq "voice"D= $name eq "passport"
ABCDresult
1XXX1
01XX1
001X1
00011
00000
156 {
157 0 push @{$result->{$name}}, $c->textContent();
158 }
159 ▶ elsif (($name eq 'taxpayerNumbers') || ($name eq 'birthday'))
Condition0%0/3
$name eq "taxpayerNumbers" or $name eq "birthday"
l!l&&r!l&&!r
000
MC/DC0%0/2
$name eq "taxpayerNumbers" or $name eq "birthday"
$name eq "taxpayerNumbers" $name eq "birthday"
Truth table0%0/3
A or B
A= $name eq "taxpayerNumbers"B= $name eq "birthday"
ABresult
1X1
011
000
160 {
161 0 $result->{$name} = $c->textContent();
162 }
163 ▶ elsif (($name eq 'intPostalInfo') || ($name eq 'locPostalInfo') || ($name eq 'legalInfo'))
Condition0%0/6
$name eq "intPostalInfo" or $name eq "locPostalInfo" or $name eq "legalInfo"
l!l&&r!l&&!r
000
$name eq "intPostalInfo" or $name eq "locPostalInfo"
l!l&&r!l&&!r
000
MC/DC0%0/3
$name eq "intPostalInfo" or $name eq "locPostalInfo" or $name eq "legalInfo"
$name eq "intPostalInfo" $name eq "locPostalInfo" $name eq "legalInfo"
Truth table0%0/4
A or B or C
A= $name eq "intPostalInfo"B= $name eq "locPostalInfo"C= $name eq "legalInfo"
ABCresult
1XX1
01X1
0011
0000
164 {
165 0 $result->{$name} = parse_address_data($c);
166 }
167 elsif ($name eq 'disclose')
168 {
169 0 $result->{disclose} = parse_disclose($c);
170 }
171 else
172 {
173 0 warn "Unspecified behaviour for tag $name"
174 }
175 }
176 0 return $result;
177 }
178  
179 sub parse_disclose
180 0 ▶{
Subroutine parse_disclose: not called CC=4 SCAR=30.0
Pod undocumented
181 0 my $c=shift;
182 0 my $flag=Net::DRI::Util::xml_parse_boolean($c->getAttribute('flag'));
183 0 my %tmp;
184 0 foreach my $el (Net::DRI::Util::xml_list_children($c))
185 {
186 0 my ($name,$n)=@$el;
187 0 ▶ if ($name=~m/^(intName|locName|birthday|passport|name|org|addr|intOrg|locOrg|intAddress|locAddress|legalAddress|taxpayerNumbers)$/)
Branch: 2 branches
BranchTrueFalseTotal
if ($name =~ /^(intName|locName|birthday|passport|name|org|addr|intOrg|locOrg|intAddress|locAddress|legalAddress|taxpayerNumbers)$/) { } 0 0 0
elsif ($name =~ /^(voice|fax|email)$/) { } 0 0 0
188 {
189 0 my $t=$n->getAttribute('type');
190 0 $tmp{$1}=$flag;
191 } elsif ($name=~m/^(voice|fax|email)$/)
192 {
193 0 $tmp{$1}=$flag;
194 }
195 else
196 {
197 0 warn "Unspecified behaviour for tag $name";
198 }
199 }
200 0 return \%tmp;
201 }
202  
203 sub parse_address_data
204 0 ▶{
Subroutine parse_address_data: not called CC=5 SCAR=34.0
Pod undocumented
205 0 my $element = shift;
206 0 my $result = {};
207 0 foreach my $el (Net::DRI::Util::xml_list_children($element))
208 {
209 0 my ($name,$c)=@$el;
210 0 ▶ if (($name eq 'name') || ($name eq 'org'))
Branch: 2 branches
BranchTrueFalseTotal
if ($name eq 'name' or $name eq 'org') { } 0 0 0
elsif ($name eq 'address') { } 0 0 0
Condition0%0/3
$name eq "name" or $name eq "org"
l!l&&r!l&&!r
000
MC/DC0%0/2
$name eq "name" or $name eq "org"
$name eq "name" $name eq "org"
Truth table0%0/3
A or B
A= $name eq "name"B= $name eq "org"
ABresult
1X1
011
000
211 {
212 0 $result->{$name} = $c->textContent();
213 }
214 elsif ($name eq 'address')
215 {
216 0 push @{$result->{$name}}, $c->textContent();
217 }
218 else
219 {
220 0 warn "Unspecified behaviour for tag $name"
221 }
222 }
223  
224 0 return $result;
225 }
226  
227 ############ Transform commands
228  
229 sub build_disclose
230 0 ▶{
Subroutine build_disclose: not called CC=11 SCAR=48.8
Pod undocumented
231 0 my $contact = shift;
232 0 my $d=$contact->disclose();
233 0 ▶ return () unless ($d && ref($d));
Branch: 1 branch
BranchTrueFalseTotal
unless $d and ref $d 0 0 0
Condition0%0/3
$d and ref $d
!ll&&!rl&&r
000
MC/DC0%0/2
$d and ref $d
$d ref $d
Truth table0%0/3
A and B
A= $dB= ref $d
ABresult
0X0
100
111
234 0 my %v=map { $_ => 1 } values(%$d);
235 0 ▶ return () unless (keys(%v)==1); ## 1 or 0 as values, not both at same time
Branch: 1 branch
BranchTrueFalseTotal
unless keys %v == 1 0 0 0
236  
237 0 my @d;
238 0 ▶ push(@d, ['contact:intName']) if (exists($d->{intName}));
Branch: 1 branch
BranchTrueFalseTotal
if exists $d->{"intName"} 0 0 0
239 0 ▶ push(@d, ['contact:locName']) if (exists($d->{locName}));
Branch: 1 branch
BranchTrueFalseTotal
if exists $d->{"locName"} 0 0 0
240  
241 0 ▶ push(@d, ['contact:org']) if (exists($d->{org}));
Branch: 1 branch
BranchTrueFalseTotal
if exists $d->{"org"} 0 0 0
242 0 ▶ push(@d, ['contact:addr']) if (exists($d->{addr}));
Branch: 1 branch
BranchTrueFalseTotal
if exists $d->{"addr"} 0 0 0
243 0 ▶ push(@d, ['contact:voice']) if (exists($d->{voice}));
Branch: 1 branch
BranchTrueFalseTotal
if exists $d->{"voice"} 0 0 0
244 0 ▶ push(@d, ['contact:fax']) if (exists($d->{fax}));
Branch: 1 branch
BranchTrueFalseTotal
if exists $d->{"fax"} 0 0 0
245 0 ▶ push(@d, ['contact:email']) if (exists($d->{email}));
Branch: 1 branch
BranchTrueFalseTotal
if exists $d->{"email"} 0 0 0
246  
247 0 return ['contact:disclose',@d,{flag=>(keys(%v))[0]}];
248 }
249  
250 sub build_cdata
251 0 ▶{
Subroutine build_cdata: not called CC=13 SCAR=52.0
Pod undocumented
252 0 my ($contact, $v) = @_;
253 0 my (@post, @addr);
254 0 my @tmp;
255 0 my @d;
256  
257 0 my ($tag_top, $tag_title, $data);
258 0 ▶ if ($contact->person())
Branch: 2 branches
BranchTrueFalseTotal
if ($contact->person) { } 0 0 0
elsif ($contact->organization) { } 0 0 0
259 {
260 0 $tag_top = 'person';
261 0 $tag_title = 'name';
262 0 $data = $contact->person();
263 }
264 elsif ($contact->organization())
265 {
266 0 $tag_top = 'organization';
267 0 $tag_title = 'org';
268 0 $data = $contact->organization();
269 }
270  
271 0 my @contact_data;
272 0 push @contact_data, ['contact:intPostalInfo' , _make_postal_info($data->{intPostalInfo}, $tag_title)];
273 0 push @contact_data, ['contact:locPostalInfo' , _make_postal_info($data->{locPostalInfo}, $tag_title)];
274  
275 0 ▶ if ($contact->organization())
Branch: 1 branch
BranchTrueFalseTotal
if ($contact->organization) 0 0 0
276 {
277 0 push @contact_data, ['contact:legalInfo' , _make_postal_info($data->{legalInfo}, $tag_title )];
278 }
279  
280 0 push @contact_data, ['contact:taxpayerNumbers', $data->{taxpayerNumbers}];
281  
282 0 ▶ if ($contact->person())
Branch: 1 branch
BranchTrueFalseTotal
if ($contact->person) 0 0 0
283 {
284 #birthday
285 0 push @contact_data, ['contact:birthday', $data->{birthday}];
286  
287 #passport
288 0 for my $str (@{$data->{passport}})
289 {
290 0 push @contact_data, ['contact:passport', $str];
291 }
292 }
293  
294 0 for my $str (@{$data->{voice}})
295 {
296 0 push @contact_data, ['contact:voice', $str];
297 }
298  
299 0 ▶ if ($data->{fax} && scalar @{$data->{fax}})
Branch: 1 branch
BranchTrueFalseTotal
if ($data->{'fax'} and scalar @{$data->{'fax'};}) { } 0 0 0
Condition0%0/2
$data->{"fax"} and scalar @{$data->{"fax"};}
!ll
00
MC/DC0%0/1
$data->{"fax"} and scalar @{$data->{"fax"};}
$data->{"fax"}
Truth table0%0/2
A
A= $data->{"fax"}
Aresult
00
11
300 {
301 0 for my $str (@{$data->{fax}})
302 {
303 0 push @contact_data, ['contact:fax', $str];
304 }
305 }
306 else
307 {
308 0 push @contact_data, ['contact:fax'];
309 }
310
311 0 for my $str (@{$data->{email}})
312 {
313 0 push @contact_data, ['contact:email', $str];
314 }
315  
316 0 push(@contact_data, build_disclose($contact));
317  
318 0 push @d, ["contact:$tag_top", @contact_data];
319  
320 0 ▶ if ($contact->verified())
Branch: 2 branches
BranchTrueFalseTotal
if ($contact->verified) { } 0 0 0
elsif ($contact->unverified) { } 0 0 0
321 {
322 0 push @d, ['contact:verified'];
323 }
324 elsif ($contact->unverified())
325 {
326 0 push @d, ['contact:unverified'];
327 }
328  
329 0 return @d;
330 }
331  
332 sub _make_postal_info
333 0 ▶{
Subroutine _make_postal_info: not called CC=3 SCAR=24.8
334 0 my $data = shift;
335 0 my $tag = shift;
336  
337 0 my @d;
338
339 0 ▶ push @d, ["contact:$tag", $data->{$tag}] if $data->{$tag};
Branch: 1 branch
BranchTrueFalseTotal
if $data->{$tag} 0 0 0
340 0 for my $str (@{$data->{address}})
341 {
342 0 push @d, ['contact:address', $str];
343 }
344  
345 0 return @d;
346 }
347  
348 sub create
349 0 ▶{
Subroutine create: not called CC=2 SCAR=17.9
Pod undocumented
350 0 my ($epp, $contact) = @_;
351 0 my $mes = $epp->message();
352 0 my @d = build_command($mes, 'create', $contact);
353  
354 0 ▶ Net::DRI::Exception->die(1, 'protocol/EPP', 10, 'Invalid contact ' .
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($contact) 0 0 0
355 $contact) unless Net::DRI::Util::isa_contact($contact);
356 0 $contact->validate(); ## will trigger an Exception if needed
357 0 push(@d, build_cdata($contact, $epp->{contacti18n}));
358 0 $mes->command_body(\@d);
359 0 return;
360 }
361  
362 sub create_parse
363 0 ▶{
Subroutine create_parse: not called CC=1 SCAR=6.9
Pod undocumented
364 0 my (@args)=@_;
365 0 return Net::DRI::Protocol::EPP::Core::Contact::create_parse(@args);
366 }
367  
368 sub update
369 0 ▶{
Subroutine update: not called CC=9 SCAR=45.0
Pod undocumented
370 0 my ($epp, $contact, $todo) = @_;
371 0 my $mes = $epp->message();
372  
373 0 ▶ Net::DRI::Exception::usererr_invalid_parameters($todo .
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_changes($todo) 0 0 0
374 ' must be a Net::DRI::Data::Changes object')
375 unless Net::DRI::Util::isa_changes($todo);
376 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
377 0 (grep { ! /^(?:set)$/ } $todo->types('info')))
378 {
379 0 Net::DRI::Exception->die(0, 'protocol/EPP', 11,
380 'Only status add/del or info set available for ' .
381 'contact');
382 }
383  
384 0 my @d = build_command($mes, 'update', $contact);
385  
386 0 my $sadd = $todo->add('status');
387 0 my $sdel = $todo->del('status');
388 0 ▶ push(@d, ['contact:add', $sadd->build_xml('contact:status')])
Branch: 1 branch
BranchTrueFalseTotal
if $sadd 0 0 0
389 if ($sadd);
390 0 ▶ push(@d, ['contact:rem', $sdel->build_xml('contact:status')])
Branch: 1 branch
BranchTrueFalseTotal
if $sdel 0 0 0
391 if ($sdel);
392  
393 0 my $newc = $todo->set('info');
394 0 ▶ if ($newc)
Branch: 1 branch
BranchTrueFalseTotal
if ($newc) 0 0 0
395 {
396 0 ▶ Net::DRI::Exception->die(1, 'protocol/EPP', 10,
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($newc) 0 0 0
397 'Invalid contact ' . $newc)
398 unless Net::DRI::Util::isa_contact($newc);
399 0 $newc->validate(1); ## will trigger an Exception if needed
400 0 my @c = build_cdata($newc, $epp->{contacti18n});
401 0 ▶ push(@d, ['contact:chg', @c]) if (@c);
Branch: 1 branch
BranchTrueFalseTotal
if @c 0 0 0
402 }
403  
404 0 $mes->command_body(\@d);
405 0 return;
406 }
407  
408 ####################################################################################################
409 1 1;
410  
411 =pod
412  
413 =head1 NAME
414  
415 Net::DRI::Protocol::EPP::Extensions::TCI::Contact - TCI EPP Contact Extension for Net::DRI
416  
417 =head1 DESCRIPTION
418  
419 Please see the README file for details.
420  
421 =head1 SUPPORT
422  
423 For now, support questions should be sent to:
424  
425 E<lt>netdri@dotandco.comE<gt>
426  
427 Please also see the SUPPORT file in the distribution.
428  
429 =head1 SEE ALSO
430  
431 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
432  
433 =head1 AUTHOR
434  
435 Dmitry Belyavsky, E<lt>beldmit@gmail.comE<gt>
436 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
437  
438 =head1 COPYRIGHT
439  
440 Copyright (c) 2010-2011 Dmitry Belyavsky <beldmit@gmail.com>
441 Copyright (c) 2011-2013,2018 Patrick Mevzek <netdri@dotandco.com>.
442 All rights reserved.
443  
444 This program is free software; you can redistribute it and/or modify
445 it under the terms of the GNU General Public License as published by
446 the Free Software Foundation; either version 2 of the License, or
447 (at your option) any later version.
448  
449 See the LICENSE file that comes with this distribution for more details.
450  
451 =cut
« DRI/Protocol/EPP/Extensions/ChangePoll.pm ↑ Summary DRI/DRD/NORID.pm »