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

filter: Statementstmt 19.2% 10 / 52 Branchbran 0.0% 0 / 26 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 42.8% 3 / 7 Podpod 0.0% 0 / 4 totaltotal 12.1% 13 / 107 CC 18 SCAR 42.6
CC
18
Cov
11%
info_parse
110.0
update
72.0
create
6.0
CRAP 70.5
« DRI/Protocol/EPP/Extensions/Afilias/Association.pm ↑ Summary DRI/Protocol/EPP/Extensions/VerificationCode.pm »
1 ## Domain Registry Interface, FCCN (.PT) Contact EPP extension commands
2 ##
3 ## Copyright (c) 2008,2009,2013,2016 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
4 ##
5 ## This file is part of Net::DRI
6 ##
7 ## Net::DRI is free software; you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation; either version 2 of the License, or
10 ## (at your option) any later version.
11 ##
12 ## See the LICENSE file that comes with this distribution for more details.
13 ####################################################################################################
14  
15 package Net::DRI::Protocol::EPP::Extensions::FCCN::Contact;
16  
17 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 =pod
23  
24 =head1 NAME
25  
26 Net::DRI::Protocol::EPP::Extensions::FCCN::Contact - FCCN (.PT) EPP Contact extensions for Net::DRI
27  
28 =head1 DESCRIPTION
29  
30 Please see the README file for details.
31  
32 =head1 SUPPORT
33  
34 For now, support questions should be sent to:
35  
36 E<lt>netdri@dotandco.comE<gt>
37  
38 Please also see the SUPPORT file in the distribution.
39  
40 =head1 SEE ALSO
41  
42 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
43  
44 =head1 AUTHOR
45  
46 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
47  
48 =head1 COPYRIGHT
49  
50 Copyright (c) 2008,2009,2013,2016 Patrick Mevzek <netdri@dotandco.com>.
51 All rights reserved.
52  
53 This program is free software; you can redistribute it and/or modify
54 it under the terms of the GNU General Public License as published by
55 the Free Software Foundation; either version 2 of the License, or
56 (at your option) any later version.
57  
58 See the LICENSE file that comes with this distribution for more details.
59  
60 =cut
61  
62 ####################################################################################################
63  
64 sub register_commands
65 {
66 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
67 0 my %tmp=(
68 create => [ \&create, undef ],
69 update => [ \&update, undef ],
70 info => [ undef, \&info_parse ],
71 );
72  
73 0 return { 'contact' => \%tmp };
74 }
75  
76 ####################################################################################################
77  
78 sub create
79 {
80 0 ▶ my ($epp,$contact)=@_;
Subroutine create: not called CC=2 SCAR=17.9
Pod undocumented
81 0 my $mes=$epp->message();
82  
83 # validate() has been called
84 0 my @n;
85 0 push @n,['ptcontact:identification',$contact->identification()->{value}];
86 0 ▶ push @n,['ptcontact:mobile',$contact->mobile()] if $contact->mobile();
Branch: 1 branch
BranchTrueFalseTotal
if $contact->mobile 0 0 0
87  
88 0 my $eid=$mes->command_extension_register('ptcontact', 'create');
89 0 $mes->command_extension($eid,\@n);
90 0 return;
91 }
92  
93 sub update
94 {
95 0 ▶ my ($epp,$contact,$todo)=@_;
Subroutine update: not called CC=8 SCAR=42.8
Pod undocumented
96  
97 0 my @n;
98 0 my $auth=$contact->auth();
99 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('Contact password is mandatory for .PT contact update') unless (defined($auth) && (ref($auth) eq 'HASH') && exists($auth->{pw}) && Net::DRI::Util::xml_is_normalizedstring($auth->{pw}));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $auth and ref $auth eq "HASH" and exists $auth->{"pw"} and Net::DRI::Util::xml_is_normalizedstring($auth->{"pw"}) 0 0 0
Condition0%0/9
defined $auth and ref $auth eq "HASH" and exists $auth->{"pw"} and Net::DRI::Util::xml_is_normalizedstring($auth->{"pw"})
!ll&&!rl&&r
000
defined $auth and ref $auth eq "HASH" and exists $auth->{"pw"}
!ll&&!rl&&r
000
defined $auth and ref $auth eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/4
defined $auth and ref $auth eq "HASH" and exists $auth->{"pw"} and Net::DRI::Util::xml_is_normalizedstring($auth->{"pw"})
defined $auth ref $auth eq "HASH" exists $auth->{"pw"} Net::DRI::Util::xml_is_normalizedstring($auth->{"pw"})
Truth table0%0/5
A and B and C and D
A= defined $authB= ref $auth eq "HASH"C= exists $auth->{"pw"}D= Net::DRI::Util::xml_is_normalizedstring($auth->{"pw"})
ABCDresult
0XXX0
10XX0
110X0
11100
11111
100 0 push @n,['ptcontact:pw',$auth->{pw}];
101  
102 0 my $newc=$todo->set('info');
103 0 ▶ if ($newc)
Branch: 1 branch
BranchTrueFalseTotal
if ($newc) 0 0 0
104 {
105 0 ▶ Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid contact '.$newc) unless Net::DRI::Util::isa_contact($newc,'Net::DRI::Data::Contact::FCCN');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($newc, "Net::DRI::Data::Contact::FCCN") 0 0 0
106 0 ▶ push @n,['ptcontact:mobile',$newc->mobile()] if $newc->mobile();
Branch: 1 branch
BranchTrueFalseTotal
if $newc->mobile 0 0 0
107 }
108  
109 0 my $mes=$epp->message();
110 0 my $eid=$mes->command_extension_register('ptcontact', 'update');
111 0 $mes->command_extension($eid,\@n);
112 0 return;
113 }
114  
115 sub info_parse
116 {
117 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=10 SCAR=47.0
Pod undocumented
118 0 my $mes=$po->message();
119 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
120  
121 0 my $infdata=$mes->get_extension('ptcontact','infData');
122 0 ▶ return unless $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless $infdata 0 0 0
123 0 my $ns=$mes->ns('ptcontact');
124  
125 0 my $co=$rinfo->{contact}->{$oname}->{self};
126 0 my $c=$infdata->getFirstChild();
127 0 ▶ while($c)
Branch: 1 branch
BranchTrueFalseTotal
if ($c) 0 0 0
128 {
129 0 ▶ next unless ($c->nodeType() == 1); ## only for element nodes
Branch: 1 branch
BranchTrueFalseTotal
unless $c->nodeType == 1 0 0 0
130 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
131 0 ▶ next unless $name;
Branch: 1 branch
BranchTrueFalseTotal
unless $name 0 0 0
132  
133 0 ▶ if ($name eq 'type')
Branch: 3 branches
BranchTrueFalseTotal
if ($name eq 'type') { } 0 0 0
elsif ($name eq 'identification') { } 0 0 0
elsif ($name eq 'mobile') { } 0 0 0
134 {
135 0 $co->type($c->getFirstChild()->getData());
136 } elsif ($name eq 'identification')
137 {
138 0 $co->identification({type=>$c->getAttribute('type'),value=>$c->getFirstChild()->getData()});
139 } elsif ($name eq 'mobile')
140 {
141 0 $co->mobile($c->getFirstChild()->getData());
142 }
143 0 } continue { $c=$c->getNextSibling(); }
144 0 return;
145 }
146  
147 ####################################################################################################
148 1 1;
« DRI/Protocol/EPP/Extensions/Afilias/Association.pm ↑ Summary DRI/Protocol/EPP/Extensions/VerificationCode.pm »