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

filter: Statementstmt 24.5% 13 / 53 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 40.0% 4 / 10 Podpod 0.0% 0 / 6 totaltotal 17.1% 17 / 99 CC 14 SCAR 30.8
CC
14
Cov
16%
info_parse
42.0
add_individual_and_consent
30.0
info
20.0
CRAP 21.8
« DRI/Protocol/EPP/Extensions/COZA/Contact.pm ↑ Summary DRI/Protocol/EPP/Extensions/VeriSign/Balance.pm »
1 ## Domain Registry Interface, .PL Contact EPP extension commands
2 ##
3 ## Copyright (c) 2006,2008,2011,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::PL::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 1 ▶use feature 'state';
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 =pod
24  
25 =head1 NAME
26  
27 Net::DRI::Protocol::EPP::Extensions::PL::Contact - .PL EPP Contact 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 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
48  
49 =head1 COPYRIGHT
50  
51 Copyright (c) 2006,2008,2011,2013,2016 Patrick Mevzek <netdri@dotandco.com>.
52 All rights reserved.
53  
54 This program is free software; you can redistribute it and/or modify
55 it under the terms of the GNU General Public License as published by
56 the Free Software Foundation; either version 2 of the License, or
57 (at your option) any later version.
58  
59 See the LICENSE file that comes with this distribution for more details.
60  
61 =cut
62  
63 ####################################################################################################
64  
65 sub register_commands
66 {
67 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
68 0 state $cmds = { 'contact' => { create => [ \&create, undef ],
69 info => [ \&info, \&info_parse ],
70 update => [ \&update, undef ],
71 }
72 };
73  
74 0 return $cmds;
75 }
76  
77 ####################################################################################################
78  
79 sub add_individual_and_consent
80 {
81 0 ▶ my ($epp,$contact,$op)=@_;
Subroutine add_individual_and_consent: not called CC=5 SCAR=34.0
Pod undocumented
82  
83 ## validate() has already been called
84 0 my $ind=$contact->individual();
85 0 my $cfp=$contact->consent_for_publishing();
86  
87 0 ▶ return unless (defined($ind) || defined($cfp));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ind or defined $cfp 0 0 0
Condition0%0/3
defined $ind or defined $cfp
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $ind or defined $cfp
defined $ind defined $cfp
Truth table0%0/3
A or B
A= defined $indB= defined $cfp
ABresult
1X1
011
000
88  
89 0 my $mes=$epp->message();
90 0 my $eid=$mes->command_extension_register('extcon', $op);
91 0 my @e;
92 0 ▶ push @e,['extcon:individual',$ind] if defined($ind);
Branch: 1 branch
BranchTrueFalseTotal
if defined $ind 0 0 0
93 0 ▶ push @e,['extcon:consentForPublishing',$cfp] if defined($cfp);
Branch: 1 branch
BranchTrueFalseTotal
if defined $cfp 0 0 0
94  
95 0 $mes->command_extension($eid,\@e);
96 0 return;
97 }
98  
99 sub create
100 {
101 0 ▶ my ($epp,$contact)=@_;
Subroutine create: not called CC=1 SCAR=6.9
Pod undocumented
102 0 return add_individual_and_consent($epp,$contact,'create');
103 }
104  
105 sub update
106 {
107 0 ▶ my ($epp,$contact,$todo)=@_;
Subroutine update: not called CC=2 SCAR=17.9
Pod undocumented
108 0 my $newc=$todo->set('info');
109 0 ▶ return unless $newc;
Branch: 1 branch
BranchTrueFalseTotal
unless $newc 0 0 0
110 0 return add_individual_and_consent($epp,$newc,'update');
111 }
112  
113 sub info
114 {
115 0 ▶ my ($epp,$contact,$ep)=@_;
Subroutine info: not called CC=4 SCAR=30.0
Pod undocumented
116 0 my $mes=$epp->message();
117  
118 0 ▶ return unless (Net::DRI::Util::has_auth($ep) && exists $ep->{auth}->{pw});
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_auth($ep) and exists $ep->{"auth"}{"pw"} 0 0 0
Condition0%0/3
Net::DRI::Util::has_auth($ep) and exists $ep->{"auth"}{"pw"}
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::has_auth($ep) and exists $ep->{"auth"}{"pw"}
Net::DRI::Util::has_auth($ep) exists $ep->{"auth"}{"pw"}
Truth table0%0/3
A and B
A= Net::DRI::Util::has_auth($ep)B= exists $ep->{"auth"}{"pw"}
ABresult
0X0
100
111
119  
120 0 my $eid=$mes->command_extension_register('extcon', 'info');
121 0 ▶ if (Net::DRI::Util::has_key($ep->{auth},'roid'))
Branch: 1 branch
BranchTrueFalseTotal
if (Net::DRI::Util::has_key($ep->{'auth'}, 'roid')) { } 0 0 0
122 {
123 0 $mes->command_extension($eid,[['extcon:authInfo',['extcon:pw',{roid=>$ep->{auth}->{roid}},$ep->{auth}->{pw}]]]);
124 } else {
125 0 $mes->command_extension($eid,[['extcon:authInfo',['extcon:pw',$ep->{auth}->{pw}]]]);
126 }
127 0 return;
128 }
129  
130 sub info_parse
131 {
132 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=6 SCAR=37.4
Pod undocumented
133 0 my $mes=$po->message();
134 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
135  
136 0 my $infdata=$mes->get_extension('extcon','infData');
137 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
138  
139 0 my $contact=$rinfo->{contact}->{$oname}->{self};
140  
141 0 foreach my $el (Net::DRI::Util::xml_list_children($infdata))
142 {
143 0 my ($name,$c)=@$el;
144 0 ▶ if ($name eq 'individual')
Branch: 2 branches
BranchTrueFalseTotal
if ($name eq 'individual') { } 0 0 0
elsif ($name eq 'consentForPublishing') { } 0 0 0
145 {
146 0 $contact->individual(Net::DRI::Util::xml_parse_boolean($c->textContent()));
147 } elsif ($name eq 'consentForPublishing')
148 {
149 0 $contact->consent_for_publishing(Net::DRI::Util::xml_parse_boolean($c->textContent()));
150 }
151 }
152 0 return;
153 }
154  
155 ####################################################################################################
156 1 1;
« DRI/Protocol/EPP/Extensions/COZA/Contact.pm ↑ Summary DRI/Protocol/EPP/Extensions/VeriSign/Balance.pm »