line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::EPP::Frame::Command::Create::Domain; |
2
|
1
|
|
|
1
|
|
7
|
use base qw(Net::EPP::Frame::Command::Create); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
92
|
|
3
|
1
|
|
|
1
|
|
6
|
use Net::EPP::Frame::ObjectSpec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1001
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=pod |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Net::EPP::Frame::Command::Create::Domain - an instance of L |
11
|
|
|
|
|
|
|
for domain objects. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Net::EPP::Frame::Command::Create::Domain; |
16
|
|
|
|
|
|
|
use strict; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $create = Net::EPP::Frame::Command::Create::Domain->new; |
19
|
|
|
|
|
|
|
$create->setDomain('example.uk.com); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
print $create->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
|
|
|
|
|
|
|
|
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/domain:name> |
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('create'), $package); |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
$self->addObject(Net::EPP::Frame::ObjectSpec->spec('domain')); |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
return $self; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=pod |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 METHODS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my $element = $frame->setDomain($domain_name); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This sets the name of the object to be created. Returns the |
70
|
|
|
|
|
|
|
Cdomain:nameE> element. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub setDomain { |
75
|
0
|
|
|
0
|
0
|
|
my ($self, $domain) = @_; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
my $name = $self->createElement('domain:name'); |
78
|
0
|
|
|
|
|
|
$name->appendText($domain); |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
$self->getNode('create')->getChildNodes->shift->appendChild($name); |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
return 1; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=pod |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
$frame->setPeriod(1, 'y'); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Set the initial registration period. The second argument is optional. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub setPeriod { |
96
|
0
|
|
|
0
|
0
|
|
my ($self, $period, $unit) = @_; |
97
|
|
|
|
|
|
|
|
98
|
0
|
0
|
0
|
|
|
|
$unit = 'y' if (!defined($unit) || $unit eq ''); |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
my $el = $self->createElement('domain:period'); |
101
|
0
|
|
|
|
|
|
$el->setAttribute('unit', $unit); |
102
|
0
|
|
|
|
|
|
$el->appendText(int($period)); |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
$self->getNode('create')->getChildNodes->shift->appendChild($el); |
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
return 1; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=pod |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
$frame->setRegistrant($id); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Set the registrant. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub setRegistrant { |
120
|
0
|
|
|
0
|
0
|
|
my ($self, $contact) = @_; |
121
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
|
my $registrant = $self->createElement('domain:registrant'); |
123
|
0
|
|
|
|
|
|
$registrant->appendText($contact); |
124
|
|
|
|
|
|
|
|
125
|
0
|
|
|
|
|
|
$self->getNode('create')->getChildNodes->shift->appendChild($registrant); |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
return 1; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=pod |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
$frame->setContacts({ |
135
|
|
|
|
|
|
|
'admin' => 'H12345', |
136
|
|
|
|
|
|
|
'tech' => 'H54321', |
137
|
|
|
|
|
|
|
'billing' => 'H23451', |
138
|
|
|
|
|
|
|
})); |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Set the contacts. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub setContacts { |
145
|
0
|
|
|
0
|
0
|
|
my ($self, $contacts) = @_; |
146
|
0
|
|
|
|
|
|
my $parent = $self->getNode('create')->getChildNodes->shift; |
147
|
|
|
|
|
|
|
|
148
|
0
|
|
|
|
|
|
foreach my $type (keys(%{$contacts})) { |
|
0
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
my $contact = $self->createElement('domain:contact'); |
150
|
0
|
|
|
|
|
|
$contact->setAttribute('type', $type); |
151
|
0
|
|
|
|
|
|
$contact->appendText($contacts->{$type}); |
152
|
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
|
$parent->appendChild($contact); |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
|
return 1; |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
# |
160
|
|
|
|
|
|
|
# Type of elements of @ns depends on NS model used by EPP server. |
161
|
|
|
|
|
|
|
# hostObj model: |
162
|
|
|
|
|
|
|
# each element is a name of NS host object |
163
|
|
|
|
|
|
|
# hostAttr model: |
164
|
|
|
|
|
|
|
# each element is a hashref: |
165
|
|
|
|
|
|
|
# { |
166
|
|
|
|
|
|
|
# name => 'ns1.example.com, |
167
|
|
|
|
|
|
|
# addrs => [ |
168
|
|
|
|
|
|
|
# { version => 'v4', addr => '192.168.0.10', }, |
169
|
|
|
|
|
|
|
# { version => 'v4', addr => '192.168.0.20', }, |
170
|
|
|
|
|
|
|
# ... |
171
|
|
|
|
|
|
|
# ]; |
172
|
|
|
|
|
|
|
# } |
173
|
|
|
|
|
|
|
# |
174
|
|
|
|
|
|
|
sub setNS { |
175
|
0
|
|
|
0
|
0
|
|
my ($self, @ns) = @_; |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
|
178
|
0
|
0
|
|
|
|
|
if ( ref $ns[0] eq 'HASH' ) { |
179
|
0
|
|
|
|
|
|
$self->addHostAttrNS(@ns); |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
else { |
182
|
0
|
|
|
|
|
|
$self->addHostObjNS(@ns); |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
0
|
|
|
|
|
|
return 1; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub addHostAttrNS { |
189
|
0
|
|
|
0
|
0
|
|
my ($self, @ns) = @_; |
190
|
|
|
|
|
|
|
|
191
|
0
|
|
|
|
|
|
my $ns = $self->createElement('domain:ns'); |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
# Adding attributes |
194
|
0
|
|
|
|
|
|
foreach my $host (@ns) { |
195
|
0
|
|
|
|
|
|
my $hostAttr = $self->createElement('domain:hostAttr'); |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
# Adding NS name |
198
|
0
|
|
|
|
|
|
my $hostName = $self->createElement('domain:hostName'); |
199
|
0
|
|
|
|
|
|
$hostName->appendText( $host->{name} ); |
200
|
0
|
|
|
|
|
|
$hostAttr->appendChild($hostName); |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
# Adding IP addresses |
203
|
0
|
0
|
0
|
|
|
|
if ( exists $host->{addrs} && ref $host->{addrs} eq 'ARRAY' ) { |
204
|
0
|
|
|
|
|
|
foreach my $addr ( @{ $host->{addrs} } ) { |
|
0
|
|
|
|
|
|
|
205
|
0
|
|
|
|
|
|
my $hostAddr = $self->createElement('domain:hostAddr'); |
206
|
0
|
|
|
|
|
|
$hostAddr->appendText( $addr->{addr} ); |
207
|
0
|
|
|
|
|
|
$hostAddr->setAttribute( ip => $addr->{version} ); |
208
|
0
|
|
|
|
|
|
$hostAttr->appendChild($hostAddr); |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
# Adding host info to frame |
213
|
0
|
|
|
|
|
|
$ns->appendChild($hostAttr); |
214
|
|
|
|
|
|
|
} |
215
|
0
|
|
|
|
|
|
$self->getNode('create')->getChildNodes->shift->appendChild($ns); |
216
|
0
|
|
|
|
|
|
return 1; |
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
sub addHostObjNS { |
220
|
0
|
|
|
0
|
0
|
|
my ($self, @ns) = @_; |
221
|
|
|
|
|
|
|
|
222
|
0
|
|
|
|
|
|
my $ns = $self->createElement('domain:ns'); |
223
|
0
|
|
|
|
|
|
foreach my $host (@ns) { |
224
|
0
|
|
|
|
|
|
my $el = $self->createElement('domain:hostObj'); |
225
|
0
|
|
|
|
|
|
$el->appendText($host); |
226
|
0
|
|
|
|
|
|
$ns->appendChild($el); |
227
|
|
|
|
|
|
|
} |
228
|
0
|
|
|
|
|
|
$self->getNode('create')->getChildNodes->shift->appendChild($ns); |
229
|
0
|
|
|
|
|
|
return 1; |
230
|
|
|
|
|
|
|
} |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
sub setAuthInfo { |
233
|
0
|
|
|
0
|
0
|
|
my ($self, $authInfo) = @_; |
234
|
0
|
|
|
|
|
|
my $el = $self->addEl('authInfo'); |
235
|
0
|
|
|
|
|
|
my $pw = $self->createElement('domain:pw'); |
236
|
0
|
|
|
|
|
|
$pw->appendText($authInfo); |
237
|
0
|
|
|
|
|
|
$el->appendChild($pw); |
238
|
0
|
|
|
|
|
|
return $el; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
sub appendStatus { |
242
|
0
|
|
|
0
|
0
|
|
my ($self, $status) = @_; |
243
|
0
|
|
|
|
|
|
return $self->addEl('status', $status); |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
sub addEl { |
247
|
0
|
|
|
0
|
0
|
|
my ($self, $name, $value) = @_; |
248
|
|
|
|
|
|
|
|
249
|
0
|
|
|
|
|
|
my $el = $self->createElement('domain:'.$name); |
250
|
0
|
0
|
|
|
|
|
$el->appendText($value) if defined($value); |
251
|
|
|
|
|
|
|
|
252
|
0
|
|
|
|
|
|
$self->getNode('create')->getChildNodes->shift->appendChild($el); |
253
|
|
|
|
|
|
|
|
254
|
0
|
|
|
|
|
|
return $el; |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
1; |