DRI/Protocol/ResultStatus.pm

filter: Statementstmt 34.6% 68 / 196 Branchbran 24.5% 28 / 114 Conditioncond 27.6% 18 / 65 MC/DCmcdc 19.4% 7 / 36 Subroutinesub 44.1% 15 / 34 Podpod 50.0% 11 / 22 totaltotal 31.4% 147 / 467 CC 84 SCAR 36.3
CC
84
Cov
30%
local_get_data
182.0
get_data_collection
72.0
is
72.0
CRAP 37.6
« DRI/Protocol/EPP/Extensions/Nomulus/Superuser.pm ↑ Summary DRI/Protocol/EPP/Extensions/Keygroup.pm »
1 ## Domain Registry Interface, Encapsulating result status, standardized on EPP codes
2 ##
3 ## Copyright (c) 2005,2006,2008-2014,2016,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
4 ##
5 ## This file is part of Net::DRI
6 ##
7 ## Net::DRI is free software; you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation; either version 2 of the License, or
10 ## (at your option) any later version.
11 ##
12 ## See the LICENSE file that comes with this distribution for more details.
13 ####################################################################################################
14  
15 package Net::DRI::Protocol::ResultStatus;
16  
17 91 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 91 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 91 ▶use base qw(Class::Accessor::Chained::Fast);
Subroutine BEGIN: called CC=1 SCAR=0.0
21 91 __PACKAGE__->mk_ro_accessors(qw(native_code code message lang next count));
22  
23 91 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 91 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 91 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 =pod
29  
30 =head1 NAME
31  
32 Net::DRI::Protocol::ResultStatus - Encapsulate Details of an Operation Result (with Standardization on EPP) for Net::DRI
33  
34 =head1 DESCRIPTION
35  
36 An object of this class represents all details of an operation result as given back from the registry,
37 with standardization on EPP as much as possible, for error codes and list of fields available.
38  
39 One object may contain one or more operation results. The object is in fact a list, starting with the
40 chronologically first/top operation result, and then using the C<next()> call progressing toward other
41 operation results, if available (each call to next gives an object of this class). The last operation result
42 can be retrieved with C<last()>.
43  
44 When an operation is done, data retrieved from the registry is also stored inside the ResultStatus object
45 (besides being available through C<< $dri->get_info() >>). It can be queried using the C<get_data()> and
46 C<get_data_collection()> methods as explained below. The data is stored as a ref hash with 3 levels:
47 the first keys have as values a reference to another hash where keys are again associated with values
48 being a reference to another hash where the content (keys and values) depends on the registry, the operation
49 attempted, and the result.
50  
51 Some data will always be there: a "session" first key, with a "exchange" subkey, will have a reference to
52 an hash with the following keys:
53  
54 =over
55  
56 =item duration_seconds
57  
58 the duration of the exchange with registry, in a floating point number of seconds
59  
60 =item raw_command
61  
62 the message sent to the registry, as string
63  
64 =item raw_reply
65  
66 the message received from the registry, as string
67  
68 =item result_from_cache
69  
70 either 0 or 1 if these results were retrieved from L<Net::DRI> Cache object or not
71  
72 =item object_action
73  
74 name of the action that has been done to achieve these results (ex: "info")
75  
76 =item object_name
77  
78 name (or ID) of the object on which the action has been performed (not necessarily always defined)
79  
80 =item object_type
81  
82 type of object on which this operation has been done (ex: "domain")
83  
84 =item registry, profile, transport, protocol
85  
86 registry name, profile name, transport name+version, protocol name+version used for this exchange
87  
88 =item trid
89  
90 transaction ID of this exchange
91  
92 =back
93  
94 =head1 METHODS
95  
96 =head2 is_success()
97  
98 returns 1 if the operation was a success
99  
100 =head2 code()
101  
102 returns the EPP code corresponding to the native code (which depends on the registry)
103 for this operation (see RFC for full list and source of this file for local extensions)
104  
105 =head2 native_code()
106  
107 gives the true status code we got back from registry (this breaks the encapsulation provided by Net::DRI, you should not use it if possible)
108  
109 =head2 message()
110  
111 gives the message attached to the the status code we got back from registry
112  
113 =head2 lang()
114  
115 gives the language in which the message above is written
116  
117 =head2 get_extended_results()
118  
119 gives back an array with additionnal result information from registry, especially in case of errors. If no data, an empty array is returned.
120  
121 This method was previously called info(), before C<Net::DRI> version 0.92_01
122  
123 =head2 get_data()
124  
125 See explanation of data stored in L</"DESCRIPTION">. Can be called with one or three parameters and always returns a single value (or undef if failure).
126  
127 With three parameters, it returns the value associated to the three keys/subkeys passed. Example: C<get_data("domain","example.com","exist")> will return
128 0 or 1 depending if the domain exists or not, after a domain check or domain info operation.
129  
130 With only one parameter, it will verify there is only one branch (besides session/exchange and message/info), and if so returns the data associated
131 to the parameter passed used as the third key. Otherwise will return undef.
132  
133 Please note that the input API is I<not> the same as the one used for C<$dri->get_info()>.
134  
135 You should not try to modify the data returned in any way, but just read it.
136  
137 =head2 get_data_collection()
138  
139 See explanation of data stored in L</"DESCRIPTION">. Can be called with either zero, one or two parameters and may return a list or a single value
140 depending on calling context (and respectively an empty list or undef in case of failure).
141  
142 With no parameter, it returns the whole data as reference to an hash with 2 levels beneath as explained in L</"DESCRIPTION"> in scalar context, or
143 the list of keys of this hash in list context.
144  
145 With one parameter, it returns the hash referenced by the key given as argument at first level in scalar context,
146 or the list of keys of this hash in list context.
147  
148 With two parameters, it walks down two level of the hash using the two parameters as key and subkey and returns the bottom hash referenced
149 in scalar context, or the list of keys of this hash in list context.
150  
151 Please note that in all cases you are given references to the data itself, not copies. You should not try to modify it in any way, but just read it.
152  
153 =head2 as_string()
154  
155 returns a string with all details, with the extended_results part if passed a true value
156  
157 =head2 print()
158  
159 same as CORE::print($rs->as_string(0)) or CORE::print($rs->as_string(1)) if passed a true value
160  
161 =head2 trid()
162  
163 in scalar context, gives the transaction id (our transaction id, that is the client part in EPP) which has generated this result,
164 in array context, gives the transaction id followed by other ids given by registry (example in EPP: server transaction id)
165  
166 =head2 is_pending()
167  
168 returns 1 if the operation was flagged as pending by registry (asynchronous handling)
169  
170 =head2 is_closing()
171  
172 returns 1 if the operation made the registry close the connection (should not happen often)
173  
174 =head2 is(NAME)
175  
176 if you really need to test some other codes (this should not happen often), you can using symbolic names
177 defined inside this module (see source).
178 Going that way makes sure you are not hardcoding numbers in your application, and you do not need
179 to import variables from this module to your application.
180  
181 =head1 SUPPORT
182  
183 For now, support questions should be sent to:
184  
185 E<lt>netdri@dotandco.comE<gt>
186  
187 Please also see the SUPPORT file in the distribution.
188  
189 =head1 SEE ALSO
190  
191 http://www.dotandco.com/services/software/Net-DRI/
192  
193 =head1 AUTHOR
194  
195 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
196  
197 =head1 COPYRIGHT
198  
199 Copyright (c) 2005,2006,2008-2014,2016,2018 Patrick Mevzek <netdri@dotandco.com>.
200 All rights reserved.
201  
202 This program is free software; you can redistribute it and/or modify
203 it under the terms of the GNU General Public License as published by
204 the Free Software Foundation; either version 2 of the License, or
205 (at your option) any later version.
206  
207 See the LICENSE file that comes with this distribution for more details.
208  
209 =cut
210  
211 ####################################################################################################
212  
213 91 our %EPP_CODES=(
214 COMMAND_SUCCESSFUL => 1000,
215 COMMAND_SUCCESSFUL_PENDING => 1001, ## needed for async registries when action done correctly on our side
216 COMMAND_SUCCESSFUL_QUEUE_EMPTY => 1300,
217 COMMAND_SUCCESSFUL_QUEUE_ACK => 1301,
218 COMMAND_SUCCESSFUL_END => 1500, ## after logout
219  
220 UNKNOWN_COMMAND => 2000,
221 COMMAND_SYNTAX_ERROR => 2001,
222 COMMAND_USE_ERROR => 2002,
223 REQUIRED_PARAMETER_MISSING => 2003,
224 PARAMETER_VALUE_RANGE_ERROR => 2004,
225 PARAMETER_VALUE_SYNTAX_ERROR => 2005,
226 UNIMPLEMENTED_PROTOCOL_VERSION => 2100,
227 UNIMPLEMENTED_COMMAND => 2101,
228 UNIMPLEMENTED_OPTION => 2102,
229 UNIMPLEMENTED_EXTENSION => 2103,
230 BILLING_FAILURE => 2104,
231 OBJECT_NOT_ELIGIBLE_FOR_RENEWAL => 2105,
232 OBJECT_NOT_ELIGIBLE_FOR_TRANSFER => 2106,
233 AUTHENTICATION_ERROR => 2200,
234 AUTHORIZATION_ERROR => 2201,
235 INVALID_AUTHORIZATION_INFO => 2202,
236 OBJECT_PENDING_TRANSFER => 2300,
237 OBJECT_NOT_PENDING_TRANSFER => 2301,
238 OBJECT_EXISTS => 2302,
239 OBJECT_DOES_NOT_EXIST => 2303,
240 OBJECT_STATUS_PROHIBITS_OPERATION => 2304,
241 OBJECT_ASSOCIATION_PROHIBITS_OPERATION => 2305,
242 PARAMETER_VALUE_POLICY_ERROR => 2306,
243 UNIMPLEMENTED_OBJECT_SERVICE => 2307,
244 DATA_MANAGEMENT_POLICY_VIOLATION => 2308,
245 COMMAND_FAILED => 2400, ## Internal server error not related to the protocol
246 COMMAND_FAILED_CLOSING => 2500, ## Same + connection dropped
247 AUTHENTICATION_ERROR_CLOSING => 2501,
248 SESSION_LIMIT_EXCEEDED_CLOSING => 2502,
249 );
250  
251 sub new
252 7 ▶{
Subroutine new: called CC=7 SCAR=20.0
Pod documented
253 7 my ($class,$type,$code,$eppcode,$is_success,$message,$lang,$info)=@_;
254 7 ▶ my %s=(
Branch: 1 branch
BranchTrueFalseTotal
defined $is_success && $is_success ? : 4 3 7
Condition85%6/7
defined $is_success and $is_success
!ll&&!rl&&r
124
$message || ''
l!l
34
$lang || '?'
l!l
07
MC/DC100%2/2
defined $is_success and $is_success
defined $is_success $is_success
MC/DC100%1/1
$message || ''
$message
MC/DC0%0/1
$lang || '?'
$lang
Truth table100%3/3
A and B
A= defined $is_successB= $is_success
ABresult
0X0
100
111
Truth table100%2/2
A
A= $message
Aresult
11
00
Truth table50%1/2
A
A= $lang
Aresult
11
00
255 is_success => (defined $is_success && $is_success)? 1 : 0,
256 native_code => $code,
257 message => $message || '',
258 type => $type, ## rrp/epp/afnic/etc...
259 lang => $lang || '?',
260 'next' => undef,
261 data => {},
262 count => 0,
263 );
264  
265 7 $s{code}=_eppcode($type,$code,$eppcode,$s{is_success});
266 7 ▶ $s{info}=(defined $info && ref $info eq 'ARRAY')? $info : [];
Branch: 1 branch
BranchTrueFalseTotal
defined $info && ref $info eq 'ARRAY' ? : 0 7 7
Condition33%1/3
defined $info and ref $info eq "ARRAY"
!ll&&!rl&&r
700
MC/DC0%0/2
defined $info and ref $info eq "ARRAY"
defined $info ref $info eq "ARRAY"
Truth table33%1/3
A and B
A= defined $infoB= ref $info eq "ARRAY"
ABresult
0X0
100
111
267 7 bless(\%s,$class);
268 7 return \%s;
269 }
270  
271 sub trid
272 0 ▶{
Subroutine trid: not called CC=4 SCAR=30.0
Pod documented
273 0 my $self=shift;
274 0 ▶ return unless (exists($self->{trid}) && (ref($self->{trid}) eq 'ARRAY'));
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"trid"} and ref $self->{"trid"} eq "ARRAY" 0 0 0
Condition0%0/3
exists $self->{"trid"} and ref $self->{"trid"} eq "ARRAY"
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{"trid"} and ref $self->{"trid"} eq "ARRAY"
exists $self->{"trid"} ref $self->{"trid"} eq "ARRAY"
Truth table0%0/3
A and B
A= exists $self->{"trid"}B= ref $self->{"trid"} eq "ARRAY"
ABresult
0X0
100
111
275 0 ▶ return wantarray()? @{$self->{trid}} : $self->{trid}->[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
276 }
277  
278 sub clone
279 0 ▶{
Subroutine clone: not called CC=2 SCAR=17.9
Pod undocumented
280 0 my ($self)=@_;
281 0 my $new={ %$self };
282 0 ▶ $new->{'next'}=$new->{'next'}->clone() if defined $new->{'next'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $new->{"next"} 0 0 0
283 ## we do not clone "data" key as it is supposed to be used read-only anyway, otherwise use Net::DRI::Util::deepcopy
284 0 bless($new,ref $self);
285 0 return $new;
286 }
287  
288 4 ▶sub local_is_success { return shift->{is_success}; }
Subroutine local_is_success: called CC=1 SCAR=0.0
Pod undocumented
289  
290 1 ▶sub local_get_extended_results { return @{shift->{info}}; }
Subroutine local_get_extended_results: called CC=1 SCAR=0.0
Pod undocumented
291  
292 sub local_get_data
293 0 ▶{
Subroutine local_get_data: not called CC=13 SCAR=52.0
Pod undocumented
294 0 my ($self,$k1,$k2,$k3)=@_;
295 0 ▶ if (! defined $k1 || (defined $k3 xor defined $k2)) { Net::DRI::Exception::err_insufficient_parameters('get_data() expects one or three parameters'); }
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $k1 or (defined $k3 xor defined $k2)) 0 0 0
Condition0%0/7
not defined $k1 or (defined $k3 xor defined $k2)
l!l&&r!l&&!r
000
defined $k3 xor defined $k2
l&&rl&&!r!l&&r!l&&!r
0000
MC/DC0%0/3
not defined $k1 or (defined $k3 xor defined $k2)
not defined $k1 defined $k3 defined $k2
Truth table0%0/5
not(A) or B xor C
A= not defined $k1B= defined $k3C= defined $k2
ABCresult
1XX1
0101
0011
0110
0000
296 0 my $d=$self->{'data'};
297  
298 ## 3 parameters form, walk the whole references tree
299 0 ▶ if (defined $k2 && defined $k3)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $k2 and defined $k3) 0 0 0
Condition0%0/3
defined $k2 and defined $k3
!ll&&!rl&&r
000
MC/DC0%0/2
defined $k2 and defined $k3
defined $k2 defined $k3
Truth table0%0/3
A and B
A= defined $k2B= defined $k3
ABresult
0X0
100
111
300 {
301 0 ($k1,$k2)=Net::DRI::Util::normalize_name($k1,$k2);
302 0 ▶ if (! exists $d->{$k1}) { return; }
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $d->{$k1}) 0 0 0
303 0 ▶ if (! exists $d->{$k1}->{$k2}) { return; }
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $d->{$k1}{$k2}) 0 0 0
304 0 ▶ if (! exists $d->{$k1}->{$k2}->{$k3}) { return; }
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $d->{$k1}{$k2}{$k3}) 0 0 0
305 0 return $d->{$k1}->{$k2}->{$k3};
306 }
307  
308 ## 1 parameter form, go directly to leafs if not too much of them (we skip session/exchange + message/info)
309 0 ▶ my @k=grep { $_ ne 'session' && $_ ne 'message' } keys %$d;
Condition0%0/3
$_ ne 'session' && $_ ne 'message'
!ll&&!rl&&r
000
MC/DC0%0/2
$_ ne 'session' && $_ ne 'message'
$_ ne 'session' $_ ne 'message'
Truth table0%0/3
A && B
A= $_ ne 'session'B= $_ ne 'message'
ABresult
0X0
100
111
310 0 ▶ if (@k != 1) { return; }
Branch: 1 branch
BranchTrueFalseTotal
if (@k != 1) 0 0 0
311 0 $d=$d->{$k[0]};
312 0 ▶ if ( keys(%$d) != 1 ) { return; }
Branch: 1 branch
BranchTrueFalseTotal
if (keys %$d != 1) 0 0 0
313 0 ($d)=values %$d;
314 0 ▶ if (! exists $d->{$k1}) { return; }
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $d->{$k1}) 0 0 0
315 0 return $d->{$k1};
316 }
317  
318 sub _rh2a
319 0 ▶{
Subroutine _rh2a: not called CC=2 SCAR=17.9
320 0 my ($in)=@_;
321 0 ▶ return $in unless wantarray;
Branch: 1 branch
BranchTrueFalseTotal
unless wantarray 0 0 0
322 0 my @r=sort { $a cmp $b } keys %$in;
323 0 return @r;
324 }
325  
326 sub local_get_data_collection
327 0 ▶{
Subroutine local_get_data_collection: not called CC=5 SCAR=34.0
Pod undocumented
328 0 my ($self,$k1,$k2)=@_;
329 0 my $d=$self->{'data'};
330  
331 0 ▶ if (! defined $k1) { return _rh2a($d); }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $k1) 0 0 0
332 0 ($k1,undef)=Net::DRI::Util::normalize_name($k1,'');
333 0 ▶ if (! exists $d->{$k1}) { return; }
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $d->{$k1}) 0 0 0
334 0 ▶ if (! defined $k2) { return _rh2a($d->{$k1}); }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $k2) 0 0 0
335 0 ($k1,$k2)=Net::DRI::Util::normalize_name($k1,$k2);
336 0 ▶ if (! exists $d->{$k1}->{$k2}) { return; }
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $d->{$k1}{$k2}) 0 0 0
337 0 return _rh2a($d->{$k1}->{$k2});
338 }
339  
340 sub is_success
341 2 ▶{
Subroutine is_success: called CC=3 SCAR=11.0
Pod documented
342 2 my ($self)=@_;
343 2 ▶ while (defined $self)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self) 2 2 4
344 {
345 2 my $is=$self->local_is_success();
346 2 ▶ return 0 unless $is;
Branch: 1 branch
BranchTrueFalseTotal
unless $is 0 2 2
347 2 } continue { $self=$self->next(); }
348 2 return 1;
349 }
350  
351 sub is_success_or_die
352 0 ▶{
Subroutine is_success_or_die: not called CC=2 SCAR=17.9
Pod undocumented
353 0 my ($self) = @_;
354 0 ▶ croak $self unless $self->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_success 0 0 0
355 0 return;
356 }
357  
358 sub get_extended_results
359 0 ▶{
Subroutine get_extended_results: not called CC=3 SCAR=24.8
Pod documented
360 0 my ($self)=@_;
361 0 my @i;
362 0 ▶ while (defined $self)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self) 0 0 0
363 {
364 0 my @li=$self->local_get_extended_results();
365 0 ▶ push @i,@li if @li;
Branch: 1 branch
BranchTrueFalseTotal
if @li 0 0 0
366 0 } continue { $self=$self->next(); }
367 0 return @i;
368 }
369  
370 sub get_data
371 0 ▶{
Subroutine get_data: not called CC=3 SCAR=24.8
Pod documented
372 0 my ($self,$k1,$k2,$k3)=@_;
373 0 my $r;
374 0 ▶ while (defined $self)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self) 0 0 0
375 {
376 0 my $lr=$self->local_get_data($k1,$k2,$k3);
377 0 ▶ $r=$lr if defined $lr;
Branch: 1 branch
BranchTrueFalseTotal
if defined $lr 0 0 0
378 0 } continue { $self=$self->next(); }
379 0 return $r;
380 }
381  
382 sub get_data_collection
383 0 ▶{
Subroutine get_data_collection: not called CC=8 SCAR=42.8
Pod documented
384 0 my ($self,$k1,$k2)=@_;
385 0 ▶ if (wantarray)
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
386 {
387 0 my %r;
388 0 ▶ while (defined $self)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self) 0 0 0
389 {
390 0 foreach my $lr ($self->local_get_data_collection($k1,$k2)) { $r{$lr}=1; }
391 0 } continue { $self=$self->next(); }
392 0 my @r=sort { $a cmp $b } keys %r;
393 0 return @r;
394 } else
395 {
396 0 my @r;
397 0 ▶ my $deep=(defined $k1 ? 1 : 0)+(defined $k2 ? 1 : 0); ## 0,1,2
Branch: 2 branches
BranchTrueFalseTotal
defined $k1 ? : 0 0 0
defined $k2 ? : 0 0 0
398 0 ▶ while (defined $self)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self) 0 0 0
399 {
400 0 my $lr=$self->local_get_data_collection($k1,$k2);
401 0 ▶ push @r,$lr if defined $lr;
Branch: 1 branch
BranchTrueFalseTotal
if defined $lr 0 0 0
402 0 } continue { $self=$self->next(); }
403 0 return _merge($deep,@r);
404 }
405 }
406  
407 sub _merge
408 15 ▶{
Subroutine _merge: called CC=5 SCAR=16.1
409 15 my ($deep,@hashes)=@_;
410  
411 ## If we are "down below", just return the "last" set of values encountered (no merge)
412 15 ▶ return $hashes[-1] if ($deep==2);
Branch: 1 branch
BranchTrueFalseTotal
if $deep == 2 11 4 15
413  
414 4 my %r;
415 my %tmp;
416 4 foreach my $rh (@hashes)
417 {
418 9 foreach my $key (sort { $a cmp $b } keys %$rh)
419 {
420 18 push @{$tmp{$key}},$rh->{$key};
421 }
422 }
423 4 foreach my $key (sort { $a cmp $b } keys %tmp)
424 {
425 12 $r{$key}=_merge($deep+1,@{$tmp{$key}});
426 }
427 4 return \%r;
428 }
429  
430 sub get_data_keys
431 0 ▶{
Subroutine get_data_keys: not called CC=2 SCAR=17.9
Pod undocumented
432 0 my ($self, $k1, $k2) = @_;
433 0 my $rh = $self->get_data_collection($k1, $k2);
434 0 my @k = sort { $a cmp $b } keys %$rh;
435 0 ▶ return wantarray ? @k : $k[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
436 }
437  
438 0 ▶sub last { my $self=shift; while ( defined $self->next() ) { $self=$self->next(); } return $self; } ## no critic (Subroutines::ProhibitBuiltinHomonyms)
Subroutine last: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->next) 0 0 0
439  
440 ## These methods are not public !
441 0 ▶sub _set_trid { my ($self,$v)=@_; $self->{'trid'}=$v; return; }
Subroutine _set_trid: not called CC=1 SCAR=6.9
442 0 ▶sub _set_last { my ($self,$v)=@_; while ( defined $self->next() ) { $self->{'count'}++; $self=$self->next(); } $self->{'count'}++; $self->{'next'}=$v; return; }
Subroutine _set_last: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->next) 0 0 0
443 0 ▶sub _set_data { my ($self,$v)=@_; $self->{'data'}=$v; return; }
Subroutine _set_data: not called CC=1 SCAR=6.9
444 sub _eppcode
445 7 ▶{
Subroutine _eppcode: called CC=10 SCAR=24.6
446 7 my ($type,$code,$eppcode,$is_success)=@_;
447 7 ▶ return $EPP_CODES{COMMAND_FAILED} unless defined $type && $type && defined $code;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type and $type and defined $code 1 6 7
Condition50%3/6
defined $type and $type and defined $code
!ll&&!rl&&r
016
defined $type and $type
!ll&&!rl&&r
007
MC/DC33%1/3
defined $type and $type and defined $code
defined $type $type defined $code
Truth table50%2/4
A and B and C
A= defined $typeB= $typeC= defined $code
ABCresult
0XX0
10X0
1100
1111
448 6 ▶ $eppcode=$code if (! defined $eppcode && $type eq 'epp');
Branch: 1 branch
BranchTrueFalseTotal
if not defined $eppcode and $type eq "epp" 2 4 6
Condition100%3/3
not defined $eppcode and $type eq "epp"
!ll&&!rl&&r
222
MC/DC100%2/2
not defined $eppcode and $type eq "epp"
not defined $eppcode $type eq "epp"
Truth table100%3/3
not(A) and B
A= not defined $eppcodeB= $type eq "epp"
ABresult
0X0
100
111
449 6 ▶ return $is_success? $EPP_CODES{COMMAND_SUCCESSFUL} : $EPP_CODES{COMMAND_FAILED} unless defined $eppcode;
Branch: 2 branches
BranchTrueFalseTotal
unless defined $eppcode 2 4 6
$is_success ? : 1 1 2
450 4 ▶ return $eppcode if $eppcode=~m/^\d{4}$/;
Branch: 1 branch
BranchTrueFalseTotal
if $eppcode =~ /^\d{4}$/ 4 0 4
451 0 ▶ return exists $EPP_CODES{$eppcode} ? $EPP_CODES{$eppcode} : $EPP_CODES{COMMAND_FAILED};
Branch: 1 branch
BranchTrueFalseTotal
exists $Net::DRI::Protocol::ResultStatus::EPP_CODES{$eppcode} ? : 0 0 0
452 }
453  
454 ## ($code,$msg,$lang,$ri) or ($msg,$lang,$ri)
455 1 ▶sub new_success { my ($class,@p)=@_; return $class->new('epp',$EPP_CODES{(@p && defined $p[0] && $p[0]=~m/^[A-Z_]+$/ && exists $EPP_CODES{$p[0]})? shift(@p) : 'COMMAND_SUCCESSFUL'},undef,1,@p); }
Subroutine new_success: called CC=5 SCAR=21.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
@p && defined $p[0] && $p[0] =~ /^[A-Z_]+$/ && exists $Net::DRI::Protocol::ResultStatus::EPP_CODES{$p[0]} ? : 0 1 1
Condition33%3/9
@p and defined $p[0] and $p[0] =~ /^[A-Z_]+$/ and exists $Net::DRI::Protocol::ResultStatus::EPP_CODES{$p[0]}
!ll&&!rl&&r
100
@p and defined $p[0] and $p[0] =~ /^[A-Z_]+$/
!ll&&!rl&&r
100
@p and defined $p[0]
!ll&&!rl&&r
010
MC/DC0%0/4
@p and defined $p[0] and $p[0] =~ /^[A-Z_]+$/ and exists $Net::DRI::Protocol::ResultStatus::EPP_CODES{$p[0]}
@p defined $p[0] $p[0] =~ /^[A-Z_]+$/ exists $Net::DRI::Protocol::ResultStatus::EPP_CODES{$p[0]}
Truth table20%1/5
A and B and C and D
A= @pB= defined $p[0]C= $p[0] =~ /^[A-Z_]+$/D= exists $Net::DRI::Protocol::ResultStatus::EPP_CODES{$p[0]}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
456 0 ▶sub new_error { my ($class,$code,@p)=@_; return $class->new('epp',$code,undef,0,@p); }
Subroutine new_error: not called CC=1 SCAR=6.9
Pod undocumented
457  
458 sub local_as_string
459 2 ▶{
Subroutine local_as_string: called CC=8 SCAR=26.0
Pod undocumented
460 2 my ($self,$withinfo)=@_;
461 2 ▶ my $r=sprintf('%s %d %s',$self->local_is_success()? 'SUCCESS' : 'ERROR',$self->code(),length $self->message() ? ($self->code() eq $self->native_code()? $self->message() : $self->message().' ['.$self->native_code().']') : '(No message given)');
Branch: 3 branches
BranchTrueFalseTotal
$self->local_is_success ? : 2 0 2
length $self->message ? : 2 0 2
$self->code eq $self->native_code ? : 2 0 2
462 2 ▶ if (defined $withinfo && $withinfo)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $withinfo and $withinfo) 1 1 2
Condition66%2/3
defined $withinfo and $withinfo
!ll&&!rl&&r
011
MC/DC50%1/2
defined $withinfo and $withinfo
defined $withinfo $withinfo
Truth table66%2/3
A and B
A= defined $withinfoB= $withinfo
ABresult
0X0
100
111
463 {
464 1 my @i=$self->local_get_extended_results();
465 0 ▶ $r.="\n".join("\n",map { my $rh=$_; "\t".(join(' ',map { $_.'='.(defined $rh->{$_} ? $rh->{$_} : '<undef>') } sort { $a cmp $b } keys %$rh)) } @i) if @i;
Branch: 2 branches
BranchTrueFalseTotal
if @i 0 1 1
defined $rh->{$_} ? : 0 0 0
466 }
467 2 return $r;
468 }
469  
470 sub as_string
471 2 ▶{
Subroutine as_string: called CC=4 SCAR=14.3
Pod documented
472 2 my ($self,$withinfo)=@_;
473 2 my @r;
474 2 ▶ while (defined $self)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self) 2 2 4
475 {
476 2 push @r,$self->local_as_string($withinfo);
477 2 } continue { $self=$self->next(); }
478 0 ▶ return wantarray ? @r : (@r==1 ? $r[0] : join("\n",map { sprintf('{%d} %s',1+$_,$r[$_]) } (0..$#r)));
Branch: 2 branches
BranchTrueFalseTotal
wantarray ? : 0 2 2
@r == 1 ? : 2 0 2
479 }
480  
481 0 ▶sub print { my ($self,$e)=@_; print $self->as_string(defined $e && $e ? 1 : 0); return; } ## no critic (Subroutines::ProhibitBuiltinHomonyms)
Subroutine print: not called CC=3 SCAR=24.8
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
defined $e && $e ? : 0 0 0
Condition0%0/3
defined $e and $e
!ll&&!rl&&r
000
MC/DC0%0/2
defined $e and $e
defined $e $e
Truth table0%0/3
A and B
A= defined $eB= $e
ABresult
0X0
100
111
482  
483 ## Should these be global too ? if so, enhance is() with third parameter to know if walking is necessary or not
484 0 ▶sub is_pending { my ($self)=@_; return $self->is('COMMAND_SUCCESSFUL_PENDING'); }
Subroutine is_pending: not called CC=1 SCAR=6.9
Pod documented
485 0 ▶sub is_closing { my ($self)=@_; return $self->is('COMMAND_SUCCESSFUL_END') || $self->is('COMMAND_FAILED_CLOSING') || $self->is('AUTHENTICATION_ERROR_CLOSING') || $self->is('SESSION_LIMIT_EXCEEDED_CLOSING'); }
Subroutine is_closing: not called CC=4 SCAR=30.0
Pod documented
Condition0%0/9
$self->is('COMMAND_SUCCESSFUL_END') || $self->is('COMMAND_FAILED_CLOSING') || $self->is('AUTHENTICATION_ERROR_CLOSING') || $self->is('SESSION_LIMIT_EXCEEDED_CLOSING')
l!l&&r!l&&!r
000
$self->is("COMMAND_SUCCESSFUL_END") or $self->is("COMMAND_FAILED_CLOSING") or $self->is("AUTHENTICATION_ERROR_CLOSING")
l!l&&r!l&&!r
000
$self->is("COMMAND_SUCCESSFUL_END") or $self->is("COMMAND_FAILED_CLOSING")
l!l&&r!l&&!r
000
MC/DC0%0/4
$self->is('COMMAND_SUCCESSFUL_END') || $self->is('COMMAND_FAILED_CLOSING') || $self->is('AUTHENTICATION_ERROR_CLOSING') || $self->is('SESSION_LIMIT_EXCEEDED_CLOSING')
$self->is("COMMAND_SUCCESSFUL_END") $self->is("COMMAND_FAILED_CLOSING") $self->is("AUTHENTICATION_ERROR_CLOSING") $self->is('SESSION_LIMIT_EXCEEDED_CLOSING')
Truth table0%0/5
A or B or C || D
A= $self->is("COMMAND_SUCCESSFUL_END")B= $self->is("COMMAND_FAILED_CLOSING")C= $self->is("AUTHENTICATION_ERROR_CLOSING")D= $self->is('SESSION_LIMIT_EXCEEDED_CLOSING')
ABCDresult
1XXX1
01XX1
001X1
00011
00000
486  
487 sub is
488 0 ▶{
Subroutine is: not called CC=8 SCAR=42.8
Pod documented
489 0 my ($self,$symcode)=@_;
490 0 ▶ Net::DRI::Exception::err_insufficient_parameters('Net::DRI::Protocol::ResultStatus->is() method expects a symbolic name') unless defined $symcode && length $symcode;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $symcode and length $symcode 0 0 0
Condition0%0/3
defined $symcode and length $symcode
!ll&&!rl&&r
000
MC/DC0%0/2
defined $symcode and length $symcode
defined $symcode length $symcode
Truth table0%0/3
A and B
A= defined $symcodeB= length $symcode
ABresult
0X0
100
111
491 0 ▶ Net::DRI::Exception::err_invalid_parameters('Symbolic name "'.$symcode.'" does not exist in Net::DRI::Protocol::ResultStatus') unless exists $EPP_CODES{$symcode};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $Net::DRI::Protocol::ResultStatus::EPP_CODES{$symcode} 0 0 0
492 0 ▶ my $code=ref $self ? $self->code() : $self;
Branch: 1 branch
BranchTrueFalseTotal
ref $self ? : 0 0 0
493 0 ▶ Net::DRI::Exception::err_invalid_parameters('Undefined or malformed code') unless defined $code && $code=~m/^\d+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $code and $code =~ /^\d+$/ 0 0 0
Condition0%0/3
defined $code and $code =~ /^\d+$/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $code and $code =~ /^\d+$/
defined $code $code =~ /^\d+$/
Truth table0%0/3
A and B
A= defined $codeB= $code =~ /^\d+$/
ABresult
0X0
100
111
494 0 ▶ return ($code == $EPP_CODES{$symcode})? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$code == $Net::DRI::Protocol::ResultStatus::EPP_CODES{$symcode} ? : 0 0 0
495 }
496  
497 ####################################################################################################
498 91 1;
« DRI/Protocol/EPP/Extensions/Nomulus/Superuser.pm ↑ Summary DRI/Protocol/EPP/Extensions/Keygroup.pm »