EPP/Frame/Command/Update/Contact.pm

filter: Statementstmt 12.9% 10 / 77 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 23.0% 3 / 13 Podpod 10.0% 1 / 10 totaltotal 12.9% 14 / 108 CC 8 SCAR 23.1
CC
8
Cov
12%
chgPostalInfo
30.0
new
6.0
addStatus
6.0
CRAP 10.1
« EPP/Frame/Command/Create/Contact.pm ↑ Summary EPP/Frame/Command/Create/Domain.pm »
1 package Net::EPP::Frame::Command::Update::Contact;
2 1 ▶use base qw(Net::EPP::Frame::Command::Update);
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Net::EPP::Frame::ObjectSpec;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =pod
7  
8 =head1 NAME
9  
10 Net::EPP::Frame::Command::Update::Contact - an instance of L<Net::EPP::Frame::Command::Update>
11 for contact objects.
12  
13 =head1 SYNOPSIS
14  
15 use Net::EPP::Frame::Command::Update::Contact;
16 use strict;
17  
18 my $info = Net::EPP::Frame::Command::Update::Contact->new;
19 $info->setContact('REG-12345');
20  
21 print $info->toString(1);
22  
23 This results in an XML document like this:
24  
25 <?xml version="1.0" encoding="UTF-8"?>
26 <epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
27 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
28 xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0
29 epp-1.0.xsd">
30 <command>
31 <info>REG-12345
32 <contact:update
33 xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
34 xsi:schemaLocation="urn:ietf:params:xml:ns:contact-1.0
35 contact-1.0.xsd">
36 <contact:id>example-1.tldE<lt>/contact:id>
37 </contact:update>
38 </info>
39 <clTRID>0cf1b8f7e14547d26f03b7641660c641d9e79f45</clTRIDE<gt>
40 </command>
41 </epp>
42  
43 =head1 OBJECT HIERARCHY
44  
45 L<XML::LibXML::Node>
46 +----L<XML::LibXML::Document>
47 +----L<Net::EPP::Frame>
48 +----L<Net::EPP::Frame::Command>
49 +----L<Net::EPP::Frame::Command::Update>
50 +----L<Net::EPP::Frame::Command::Update::Contact>
51  
52 =cut
53  
54 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
55 0 my $package = shift;
56 0 my $self = bless($package->SUPER::new('update'), $package);
57  
58 0 my $contact = $self->addObject(Net::EPP::Frame::ObjectSpec->spec('contact'));
59  
60 0 foreach my $grp (qw(add rem chg)) {
61 0 my $el = $self->createElement(sprintf('contact:%s', $grp));
62 0 $self->getNode('update')->getChildNodes->shift->appendChild($el);
63 }
64  
65 0 return $self;
66 }
67  
68 =pod
69  
70 =head1 METHODS
71  
72 $frame->setContact($id);
73  
74 This specifies the contact object to be updated.
75  
76 =cut
77  
78 0 ▶sub setContact {
Subroutine setContact: not called CC=1 SCAR=6.9
Pod undocumented
79 0 my ($self, $id) = @_;
80  
81 0 my $el = $self->createElement('contact:id');
82 0 $el->appendText($id);
83  
84 0 my $n = $self->getNode('update')->getChildNodes->shift;
85 0 $n->insertBefore($el, $n->firstChild);
86  
87 0 return 1;
88 }
89  
90 =pod
91  
92 $frame->chgVoice($voice);
93  
94 Change the contacts voice number.
95  
96 =cut
97  
98 0 ▶sub chgVoice {
Subroutine chgVoice: not called CC=1 SCAR=6.9
Pod undocumented
99 0 my ($self, $voice) = @_;
100 0 return $self->addEl('voice', $voice);
101 }
102  
103 =pod
104  
105 $frame->chgFax($fax);
106  
107 Change the contacts voice number.
108  
109 =cut
110  
111 0 ▶sub chgFax {
Subroutine chgFax: not called CC=1 SCAR=6.9
Pod undocumented
112 0 my ($self, $fax) = @_;
113 0 return $self->addEl('fax', $fax);
114 }
115  
116 =pod
117  
118 $frame->chgEmail($email);
119  
120 Change the contacts email.
121  
122 =cut
123  
124 0 ▶sub chgEmail {
Subroutine chgEmail: not called CC=1 SCAR=6.9
Pod undocumented
125 0 my ($self, $email) = @_;
126 0 return $self->addEl('email', $email);
127 }
128  
129 =pod
130  
131 $frame->addStatus($type, $info);
132  
133 Add a status of $type with the optional extra $info.
134  
135 =cut
136  
137 0 ▶sub addStatus {
Subroutine addStatus: not called CC=2 SCAR=17.9
Pod undocumented
138 0 my ($self, $type, $info) = @_;
139 0 my $status = $self->createElement('contact:status');
140 0 $status->setAttribute('s', $type);
141 0 $status->setAttribute('lang', 'en');
142 0 ▶ if ($info) {
Branch: 1 branch
BranchTrueFalseTotal
if ($info) 0 0 0
143 0 $status->appendText($info);
144 }
145 0 $self->getElementsByLocalName('contact:add')->shift->appendChild($status);
146 0 return 1;
147 }
148  
149 =pod
150  
151 $frame->remStatus($type);
152  
153 Remove a status of $type.
154  
155 =cut
156  
157 0 ▶sub remStatus {
Subroutine remStatus: not called CC=1 SCAR=6.9
Pod undocumented
158 0 my ($self, $type) = @_;
159 0 my $status = $self->createElement('contact:status');
160 0 $status->setAttribute('s', $type);
161 0 $self->getElementsByLocalName('contact:rem')->shift->appendChild($status);
162 0 return 1;
163 }
164  
165 0 ▶sub chgPostalInfo {
Subroutine chgPostalInfo: not called CC=5 SCAR=34.0
Pod undocumented
166 0 my ($self, $type, $name, $org, $addr) = @_;
167  
168 0 my $el = $self->createElement('contact:postalInfo');
169 0 $el->setAttribute('type', $type);
170  
171 0 my $nel = $self->createElement('contact:name');
172 0 $nel->appendText($name);
173  
174 0 my $oel = $self->createElement('contact:org');
175 0 $oel->appendText($org);
176  
177 0 my $ael = $self->createElement('contact:addr');
178  
179 0 ▶ if (ref($addr->{street}) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $addr->{"street"} eq "ARRAY") 0 0 0
180 0 foreach my $street (@{$addr->{street}}) {
181 0 my $sel = $self->createElement('contact:street');
182 0 $sel->appendText($street);
183 0 $ael->appendChild($sel);
184 }
185 }
186  
187 0 foreach my $name (qw(city sp pc cc)) {
188 0 my $vel = $self->createElement('contact:' . $name);
189 0 $vel->appendText($addr->{$name});
190 0 $ael->appendChild($vel);
191 }
192  
193 0 $el->appendChild($nel);
194 0 ▶ $el->appendChild($oel) if $org;
Branch: 1 branch
BranchTrueFalseTotal
if $org 0 0 0
195 0 $el->appendChild($ael);
196  
197 0 $self->getElementsByLocalName('contact:chg')->shift->appendChild($el);
198  
199 0 return $el;
200 }
201  
202 =pod
203  
204 $frame->chgAuthinfo($auth);
205  
206 Change the authinfo.
207  
208 =cut
209  
210 0 ▶sub chgAuthInfo {
Subroutine chgAuthInfo: not called CC=1 SCAR=6.9
Pod undocumented
211 0 my ($self, $authInfo) = @_;
212  
213 0 my $el = $self->createElement('contact:authInfo');
214 0 my $pw = $self->createElement('contact:pw');
215 0 $pw->appendText($authInfo);
216 0 $el->appendChild($pw);
217  
218 0 $self->getElementsByLocalName('contact:chg')->shift->appendChild($el);
219 0 return 1;
220 }
221  
222 0 ▶sub addEl {
Subroutine addEl: not called CC=2 SCAR=17.9
Pod undocumented
223 0 my ($self, $name, $value) = @_;
224  
225 0 my $el = $self->createElement('contact:' . $name);
226 0 ▶ $el->appendText($value) if defined($value);
Branch: 1 branch
BranchTrueFalseTotal
if defined $value 0 0 0
227  
228 0 $self->getElementsByLocalName('contact:chg')->shift->appendChild($el);
229  
230 0 return $el;
231  
232 }
233  
234 1 1;
« EPP/Frame/Command/Create/Contact.pm ↑ Summary EPP/Frame/Command/Create/Domain.pm »