line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::EPP::Frame::Command::Update::Contact; |
2
|
1
|
|
|
1
|
|
7
|
use base qw(Net::EPP::Frame::Command::Update); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
101
|
|
3
|
1
|
|
|
1
|
|
6
|
use Net::EPP::Frame::ObjectSpec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
858
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=pod |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Net::EPP::Frame::Command::Update::Contact - an instance of L |
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
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
REG-12345 |
32
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
example-1.tldE/contact:id> |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
0cf1b8f7e14547d26f03b7641660c641d9e79f45 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 OBJECT HIERARCHY |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
L |
46
|
|
|
|
|
|
|
+----L |
47
|
|
|
|
|
|
|
+----L |
48
|
|
|
|
|
|
|
+----L |
49
|
|
|
|
|
|
|
+----L |
50
|
|
|
|
|
|
|
+----L |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub new { |
55
|
0
|
|
|
0
|
1
|
|
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
|
|
|
|
|
|
|
sub setContact { |
79
|
0
|
|
|
0
|
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
|
|
|
|
|
|
|
sub chgVoice { |
99
|
0
|
|
|
0
|
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
|
|
|
|
|
|
|
sub chgFax { |
112
|
0
|
|
|
0
|
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
|
|
|
|
|
|
|
sub chgEmail { |
125
|
0
|
|
|
0
|
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
|
|
|
|
|
|
|
sub addStatus { |
138
|
0
|
|
|
0
|
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
|
0
|
|
|
|
|
if ($info) { |
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
|
|
|
|
|
|
|
sub remStatus { |
158
|
0
|
|
|
0
|
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
|
|
|
|
|
|
|
sub chgPostalInfo { |
166
|
0
|
|
|
0
|
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
|
0
|
|
|
|
|
if (ref($addr->{street}) eq 'ARRAY') { |
180
|
0
|
|
|
|
|
|
foreach my $street (@{$addr->{street}}) { |
|
0
|
|
|
|
|
|
|
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
|
0
|
|
|
|
|
$el->appendChild($oel) if $org; |
195
|
0
|
|
|
|
|
|
$el->appendChild($ael); |
196
|
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
|
$self->getElementsByLocalName('contact:chg')->shift->appendChild($el); |
198
|
|
|
|
|
|
|
|
199
|
0
|
|
|
|
|
|
return $el; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=pod |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
$frame->chgAuthinfo($auth); |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Change the authinfo. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=cut |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
sub chgAuthInfo { |
212
|
0
|
|
|
0
|
0
|
|
my ($self,$authInfo) = @_; |
213
|
|
|
|
|
|
|
|
214
|
0
|
|
|
|
|
|
my $el = $self->createElement('contact:authInfo'); |
215
|
0
|
|
|
|
|
|
my $pw = $self->createElement('contact:pw'); |
216
|
0
|
|
|
|
|
|
$pw->appendText($authInfo); |
217
|
0
|
|
|
|
|
|
$el->appendChild($pw); |
218
|
|
|
|
|
|
|
|
219
|
0
|
|
|
|
|
|
$self->getElementsByLocalName('contact:chg')->shift->appendChild($el); |
220
|
0
|
|
|
|
|
|
return 1; |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
sub addEl { |
224
|
0
|
|
|
0
|
0
|
|
my ($self, $name, $value) = @_; |
225
|
|
|
|
|
|
|
|
226
|
0
|
|
|
|
|
|
my $el = $self->createElement('contact:'.$name); |
227
|
0
|
0
|
|
|
|
|
$el->appendText($value) if defined($value); |
228
|
|
|
|
|
|
|
|
229
|
0
|
|
|
|
|
|
$self->getElementsByLocalName('contact:chg')->shift->appendChild($el); |
230
|
|
|
|
|
|
|
|
231
|
0
|
|
|
|
|
|
return $el; |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
1; |