line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (c) 2016 CentralNic Ltd. All rights reserved. This program is |
2
|
|
|
|
|
|
|
# free software; you can redistribute it and/or modify it under the same |
3
|
|
|
|
|
|
|
# terms as Perl itself. |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# $Id: Contact.pm,v 1.3 2011/12/14 12:02:08 gavin Exp $ |
6
|
|
|
|
|
|
|
package Net::EPP::Frame::Command::Create::Contact; |
7
|
1
|
|
|
1
|
|
5
|
use base qw(Net::EPP::Frame::Command::Create); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
60
|
|
8
|
1
|
|
|
1
|
|
5
|
use Net::EPP::Frame::ObjectSpec; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
13
|
|
9
|
1
|
|
|
1
|
|
2
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
338
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=pod |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Net::EPP::Frame::Command::Create::Contact - an instance of L |
16
|
|
|
|
|
|
|
for contact objects. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Net::EPP::Frame::Command::Create::Contact; |
21
|
|
|
|
|
|
|
use strict; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $create = Net::EPP::Frame::Command::Create::Contact->new; |
24
|
|
|
|
|
|
|
$create->setContact('contact-id); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
print $create->toString(1); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
This results in an XML document like this: |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
33
|
|
|
|
|
|
|
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 |
34
|
|
|
|
|
|
|
epp-1.0.xsd"> |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" |
39
|
|
|
|
|
|
|
xsi:schemaLocation="urn:ietf:params:xml:ns:contact-1.0 |
40
|
|
|
|
|
|
|
contact-1.0.xsd"> |
41
|
|
|
|
|
|
|
example-1.tldE/contact:id> |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
0cf1b8f7e14547d26f03b7641660c641d9e79f45 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 OBJECT HIERARCHY |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
L |
51
|
|
|
|
|
|
|
+----L |
52
|
|
|
|
|
|
|
+----L |
53
|
|
|
|
|
|
|
+----L |
54
|
|
|
|
|
|
|
+----L |
55
|
|
|
|
|
|
|
+----L |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub new { |
60
|
0
|
|
|
0
|
0
|
|
my $package = shift; |
61
|
0
|
|
|
|
|
|
my $self = bless($package->SUPER::new('create'), $package); |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
$self->addObject(Net::EPP::Frame::ObjectSpec->spec('contact')); |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
return $self; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=pod |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 METHODS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
my $element = $frame->setContact($contact_id); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This sets the contact ID of the object to be created. Returns the |
75
|
|
|
|
|
|
|
Ccontact:nameE> element. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub setContact { |
80
|
0
|
|
|
0
|
0
|
|
my ($self, $id) = @_; |
81
|
0
|
|
|
|
|
|
return $self->addEl('id', $id); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub setVoice { |
85
|
0
|
|
|
0
|
0
|
|
my ($self, $voice) = @_; |
86
|
0
|
|
|
|
|
|
return $self->addEl('voice', $voice); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub setFax { |
90
|
0
|
|
|
0
|
0
|
|
my ($self, $fax) = @_; |
91
|
0
|
|
|
|
|
|
return $self->addEl('fax', $fax); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub setEmail { |
95
|
0
|
|
|
0
|
0
|
|
my ($self, $email) = @_; |
96
|
0
|
|
|
|
|
|
return $self->addEl('email', $email); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub setAuthInfo { |
100
|
0
|
|
|
0
|
0
|
|
my ($self, $authInfo) = @_; |
101
|
0
|
|
|
|
|
|
my $el = $self->addEl('authInfo'); |
102
|
0
|
|
|
|
|
|
my $pw = $self->createElement('contact:pw'); |
103
|
0
|
|
|
|
|
|
$pw->appendText($authInfo); |
104
|
0
|
|
|
|
|
|
$el->appendChild($pw); |
105
|
0
|
|
|
|
|
|
return $el; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub addPostalInfo { |
109
|
0
|
|
|
0
|
0
|
|
my ($self, $type, $name, $org, $addr) = @_; |
110
|
0
|
|
|
|
|
|
my $el = $self->addEl('postalInfo'); |
111
|
0
|
|
|
|
|
|
$el->setAttribute('type', $type); |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
my $nel = $self->createElement('contact:name'); |
114
|
0
|
|
|
|
|
|
$nel->appendText($name); |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
my $oel = $self->createElement('contact:org'); |
117
|
0
|
|
|
|
|
|
$oel->appendText($org); |
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
my $ael = $self->createElement('contact:addr'); |
120
|
|
|
|
|
|
|
|
121
|
0
|
0
|
|
|
|
|
if (ref($addr->{street}) eq 'ARRAY') { |
122
|
0
|
|
|
|
|
|
foreach my $street (@{$addr->{street}}) { |
|
0
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
my $sel = $self->createElement('contact:street'); |
124
|
0
|
|
|
|
|
|
$sel->appendText($street); |
125
|
0
|
|
|
|
|
|
$ael->appendChild($sel); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
foreach my $name (qw(city sp pc cc)) { |
130
|
0
|
|
|
|
|
|
my $vel = $self->createElement('contact:'.$name); |
131
|
0
|
|
|
|
|
|
$vel->appendText($addr->{$name}); |
132
|
0
|
|
|
|
|
|
$ael->appendChild($vel); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
$el->appendChild($nel); |
136
|
0
|
0
|
|
|
|
|
$el->appendChild($oel) if $org; |
137
|
0
|
|
|
|
|
|
$el->appendChild($ael); |
138
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
return $el; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub appendStatus { |
143
|
0
|
|
|
0
|
0
|
|
my ($self, $status) = @_; |
144
|
0
|
|
|
|
|
|
return $self->addEl('status', $status); |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub addEl { |
148
|
0
|
|
|
0
|
0
|
|
my ($self, $name, $value) = @_; |
149
|
|
|
|
|
|
|
|
150
|
0
|
|
|
|
|
|
my $el = $self->createElement('contact:'.$name); |
151
|
0
|
0
|
|
|
|
|
$el->appendText($value) if defined($value); |
152
|
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
|
$self->getNode('create')->getChildNodes->shift->appendChild($el); |
154
|
|
|
|
|
|
|
|
155
|
0
|
|
|
|
|
|
return $el; |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=pod |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 AUTHOR |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
CentralNic Ltd (http://www.centralnic.com/). |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 COPYRIGHT |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
This module is (c) 2016 CentralNic Ltd. This module is free software; you can |
168
|
|
|
|
|
|
|
redistribute it and/or modify it under the same terms as Perl itself. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 SEE ALSO |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=over |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=item * L |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=back |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=cut |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
1; |