File Coverage

blib/lib/Net/EPP/ResponseCodes.pm
Criterion Covered Total %
statement 114 114 100.0
branch n/a
condition n/a
subroutine 38 38 100.0
pod n/a
total 152 152 100.0


line stmt bran cond sub pod time code
1             package Net::EPP::ResponseCodes;
2 1     1   8 use base qw(Exporter);
  1         14  
  1         157  
3 1     1   8 use vars qw(@EXPORT);
  1         2  
  1         82  
4 1     1   8 use strict;
  1         3  
  1         68  
5              
6             =head1 NAME
7              
8             Net::EPP::ResponseCodes - a module to export some constants that correspond to
9             EPP response codes.
10              
11             =head1 SYNOPSIS
12              
13             use Net::EPP::ResponseCodes;
14             use Net::EPP::Simple;
15             use strict;
16              
17             my $epp = Net::EPP::Simple->new(
18             host => 'epp.nic.tld',
19             user => 'my-id',
20             pass => 'my-password',
21             );
22              
23             my $result = $epp->domain_transfer_request('example.tld', 'foobar', 1);
24              
25             if ($result) {
26             print "Transfer initiated OK\n";
27              
28             } else {
29             if ($Net::EPP::Simple::Code == OBJECT_PENDING_TRANSFER) {
30             print "Error: domain is already pending transfer\n";
31              
32             } elsif ($Net::EPP::Simple::Code == INVALID_AUTH_INFO) {
33             print "Error: invalid authcode provided\n";
34              
35             } elsif ($Net::EPP::Simple::Code == OBJECT_DOES_NOT_EXIST) {
36             print "Error: domain not found\n";
37              
38             } elsif ($Net::EPP::Simple::Code == STATUS_PROHIBITS_OP) {
39             print "Error: domain cannot be transferred\n";
40              
41             } else {
42             print "Error code $Net::EPP::Simple::Code\n";
43              
44             }
45             }
46              
47             =head1 DESCRIPTION
48              
49             Every response sent to the client by an EPP server contains at least one
50             CresultE> element that has a C attribute. This is a four-digit
51             numeric code that describes the result of the request. This module exports a set
52             of constants that provide handy mnemonics for each of the defined codes.
53              
54             =head1 EXPORTS
55              
56             C exports the following constants. The number in
57             brackets is the integer value associated with the constant.
58              
59             =head2 Successful command completion responses (1nnn)
60              
61             =over
62              
63             =item OK (1000)
64              
65             =item OK_PENDING (1001)
66              
67             =item OK_NO_MESSAGES (1300)
68              
69             =item OK_MESSAGES (1301)
70              
71             =item OK_BYE (1500)
72              
73             =back
74              
75             =head2 Command error responses (2nnn)
76              
77             =head3 Protocol Syntax
78              
79             =over
80              
81             =item UNKNOWN_COMMAND (2000)
82              
83             =item SYNTAX_ERROR (2001)
84              
85             =item USE_ERROR (2002)
86              
87             =item MISSING_PARAM (2003)
88              
89             =item PARAM_RANGE_ERROR (2004)
90              
91             =item PARAM_SYNTAX_ERROR (2005)
92              
93             =back
94              
95             =head3 Implementation-specific Rules
96              
97             =over
98              
99             =item UNIMPLEMENTED_VERSION (2100)
100              
101             =item UNIMPLEMENTED_COMMAND (2101)
102              
103             =item UNIMPLEMENTED_OPTION (2102)
104              
105             =item UNIMPLEMENTED_EXTENSION (2103)
106              
107             =item BILLING_FAILURE (2104)
108              
109             =item NOT_RENEWABLE (2105)
110              
111             =item NOT_TRANSFERRABLE (2106)
112              
113             =back
114              
115             =head3 Security (22nn)
116              
117             =over
118              
119             =item AUTHENTICATION_ERROR (2200)
120              
121             =item AUTHORISATION_ERROR (2201)
122              
123             =item AUTHORIZATION_ERROR (2201)
124              
125             =item INVALID_AUTH_INFO (2202)
126              
127             =back
128              
129             =head3 Data Management (23nn)
130              
131             =over
132              
133             =item OBJECT_PENDING_TRANSFER (2300)
134              
135             =item OBJECT_NOT_PENDING_TRANSFER (2301)
136              
137             =item OBJECT_EXISTS (2302)
138              
139             =item OBJECT_DOES_NOT_EXIST (2303)
140              
141             =item STATUS_PROHIBITS_OP (2304)
142              
143             =item ASSOC_PROHIBITS_OP (2305)
144              
145             =item PARAM_POLICY_ERROR (2306)
146              
147             =item UNIMPLEMENTED_OBJECT_SERVICE (2307)
148              
149             =item DATA_MGMT_POLICY_VIOLATION (2308)
150              
151             =back
152              
153             =head3 Server System (24nn)
154              
155             =over
156              
157             =item COMMAND_FAILED (2400)
158              
159             =back
160              
161             =head3 Connection Management (25nn)
162              
163             =over
164              
165             =item COMMAND_FAILED_BYE (2500)
166              
167             =item AUTH_FAILED_BYE (2501)
168              
169             =item SESSION_LIMIT_EXCEEDED_BYE (2502)
170              
171             =back
172              
173             =head1 COPYRIGHT
174              
175             This module is (c) 2008 - 2023 CentralNic Ltd and 2024 Gavin Brown. This module
176             is free software; you can redistribute it and/or modify it under the same terms
177             as Perl itself.
178              
179             =cut
180              
181             #
182             # Successful command completion responses:
183             #
184 1     1   6 use constant OK => 1000;
  1         2  
  1         104  
185 1     1   8 use constant OK_PENDING => 1001;
  1         2  
  1         55  
186 1     1   17 use constant OK_NO_MESSAGES => 1300;
  1         2  
  1         57  
187 1     1   6 use constant OK_MESSAGES => 1301;
  1         6  
  1         75  
188 1     1   7 use constant OK_BYE => 1500;
  1         2  
  1         60  
189              
190             #
191             # Command error responses:
192             #
193              
194             # Protocol Syntax:
195 1     1   6 use constant UNKNOWN_COMMAND => 2000;
  1         1  
  1         44  
196 1     1   5 use constant SYNTAX_ERROR => 2001;
  1         2  
  1         54  
197 1     1   5 use constant USE_ERROR => 2002;
  1         2  
  1         42  
198 1     1   5 use constant MISSING_PARAM => 2003;
  1         11  
  1         80  
199 1     1   6 use constant PARAM_RANGE_ERROR => 2004;
  1         2  
  1         59  
200 1     1   6 use constant PARAM_SYNTAX_ERROR => 2005;
  1         2  
  1         49  
201              
202             # Implementation-specific Rules:
203 1     1   5 use constant UNIMPLEMENTED_VERSION => 2100;
  1         2  
  1         86  
204 1     1   43 use constant UNIMPLEMENTED_COMMAND => 2101;
  1         2  
  1         58  
205 1     1   5 use constant UNIMPLEMENTED_OPTION => 2102;
  1         2  
  1         56  
206 1     1   5 use constant UNIMPLEMENTED_EXTENSION => 2103;
  1         3  
  1         49  
207 1     1   5 use constant BILLING_FAILURE => 2104;
  1         3  
  1         59  
208 1     1   21 use constant NOT_RENEWABLE => 2105;
  1         3  
  1         48  
209 1     1   7 use constant NOT_TRANSFERRABLE => 2106;
  1         2  
  1         44  
210              
211             # Security:
212 1     1   5 use constant AUTHENTICATION_ERROR => 2200;
  1         15  
  1         51  
213 1     1   7 use constant AUTHORISATION_ERROR => 2201;
  1         2  
  1         60  
214 1     1   6 use constant AUTHORIZATION_ERROR => 2201;
  1         2  
  1         69  
215 1     1   17 use constant INVALID_AUTH_INFO => 2202;
  1         2  
  1         53  
216              
217             # Data Management:
218 1     1   6 use constant OBJECT_PENDING_TRANSFER => 2300;
  1         2  
  1         85  
219 1     1   6 use constant OBJECT_NOT_PENDING_TRANSFER => 2301;
  1         2  
  1         50  
220 1     1   6 use constant OBJECT_EXISTS => 2302;
  1         1  
  1         65  
221 1     1   6 use constant OBJECT_DOES_NOT_EXIST => 2303;
  1         1  
  1         60  
222 1     1   54 use constant STATUS_PROHIBITS_OP => 2304;
  1         4  
  1         60  
223 1     1   5 use constant ASSOC_PROHIBITS_OP => 2305;
  1         2  
  1         44  
224 1     1   4 use constant PARAM_POLICY_ERROR => 2306;
  1         3  
  1         75  
225 1     1   7 use constant UNIMPLEMENTED_OBJECT_SERVICE => 2307;
  1         2  
  1         61  
226 1     1   6 use constant DATA_MGMT_POLICY_VIOLATION => 2308;
  1         2  
  1         59  
227              
228             # Server System:
229 1     1   6 use constant COMMAND_FAILED => 2400;
  1         1  
  1         62  
230              
231             # Connection Management:
232 1     1   7 use constant COMMAND_FAILED_BYE => 2500;
  1         2  
  1         63  
233 1     1   6 use constant AUTH_FAILED_BYE => 2501;
  1         2  
  1         56  
234 1     1   6 use constant SESSION_LIMIT_EXCEEDED_BYE => 2502;
  1         1  
  1         181  
235              
236             our @EXPORT;
237             my $package = __PACKAGE__;
238             foreach my $constant (keys(%constant::declared)) {
239             if ($constant =~ /^$package/) {
240             $constant =~ s/^$package\:\://;
241             push(@EXPORT, $constant);
242             }
243             }
244              
245             1;