DRI/Protocol/EPP/Message.pm

filter: Statementstmt 68.8% 146 / 212 Branchbran 43.9% 36 / 82 Conditioncond 29.0% 18 / 62 MC/DCmcdc 0.0% 0 / 36 Subroutinesub 78.3% 29 / 37 Podpod 4.7% 1 / 21 totaltotal 51.1% 230 / 450 CC 68 SCAR 36.6
CC
68
Cov
56%
as_string
110.4
parse
60.2
_get_content
12.3
CRAP 39.0
« DRI/Protocol/EPP/Extensions/AusRegistry/IDN.pm ↑ Summary DRI/Protocol/EPP/Extensions/AusRegistry/KeyValue.pm »
1 ## Domain Registry Interface, EPP Message
2 ##
3 ## Copyright (c) 2005-2014,2016,2018-2019 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::EPP::Message;
16  
17 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 3 ▶use DateTime::Format::ISO8601 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
22 3 ▶use DateTime ();
Subroutine BEGIN: called CC=1 SCAR=0.0
23 3 ▶use XML::LibXML ();
Subroutine BEGIN: called CC=1 SCAR=0.0
24 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 3 ▶use Net::DRI::Protocol::ResultStatus;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 3 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 3 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 3 ▶use Net::DRI::Protocol::EPP::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 3 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 3 ▶use base qw(Class::Accessor::Chained::Fast Net::DRI::Protocol::Message);
Subroutine BEGIN: called CC=1 SCAR=0.0
33 3 __PACKAGE__->mk_accessors(qw(version command command_body cltrid svtrid msg_id node_resdata node_extension node_msg node_greeting operation));
34  
35 =pod
36  
37 =head1 NAME
38  
39 Net::DRI::Protocol::EPP::Message - EPP Message for Net::DRI
40  
41 =head1 DESCRIPTION
42  
43 Please see the README file for details.
44  
45 =head1 SUPPORT
46  
47 For now, support questions should be sent to:
48  
49 E<lt>netdri@dotandco.comE<gt>
50  
51 Please also see the SUPPORT file in the distribution.
52  
53 =head1 SEE ALSO
54  
55 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
56  
57 =head1 AUTHOR
58  
59 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
60  
61 =head1 COPYRIGHT
62  
63 Copyright (c) 2005-2014,2016,2018-2019 Patrick Mevzek <netdri@dotandco.com>.
64 All rights reserved.
65  
66 This program is free software; you can redistribute it and/or modify
67 it under the terms of the GNU General Public License as published by
68 the Free Software Foundation; either version 2 of the License, or
69 (at your option) any later version.
70  
71 See the LICENSE file that comes with this distribution for more details.
72  
73 =cut
74  
75 ####################################################################################################
76  
77 sub new
78 10 ▶{
Subroutine new: called CC=3 SCAR=11.6
Pod documented
79 10 my ($class,$trid,$otype,$oaction)=@_;
80 10 my $self={ results => [], ns => {} };
81 10 bless($self,$class);
82  
83 10 ▶ $self->cltrid($trid) if (defined $trid && length $trid);
Branch: 1 branch
BranchTrueFalseTotal
if defined $trid and length $trid 0 10 10
Condition33%1/3
defined $trid and length $trid
!ll&&!rl&&r
1000
MC/DC0%0/2
defined $trid and length $trid
defined $trid length $trid
Truth table33%1/3
A and B
A= defined $tridB= length $trid
ABresult
0X0
100
111
84 10 $self->operation([$otype,$oaction]);
85 10 return $self;
86 }
87  
88 sub _get_result
89 8 ▶{
Subroutine _get_result: called CC=5 SCAR=18.1
90 8 my ($self,$what,$pos)=@_;
91 8 ▶ my $rh=$self->{results}->[defined $pos ? $pos : 0];
Branch: 1 branch
BranchTrueFalseTotal
defined $pos ? : 4 4 8
92 8 ▶ return unless (defined $rh && ref $rh eq 'HASH' && keys(%$rh)==4);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $rh and ref $rh eq "HASH" and keys %$rh == 4 0 8 8
Condition33%2/6
defined $rh and ref $rh eq "HASH" and keys %$rh == 4
!ll&&!rl&&r
008
defined $rh and ref $rh eq "HASH"
!ll&&!rl&&r
008
MC/DC0%0/3
defined $rh and ref $rh eq "HASH" and keys %$rh == 4
defined $rh ref $rh eq "HASH" keys %$rh == 4
Truth table25%1/4
A and B and C
A= defined $rhB= ref $rh eq "HASH"C= keys %$rh == 4
ABCresult
0XX0
10X0
1100
1111
93 8 return $rh->{$what};
94 }
95  
96 3 ▶sub results { return @{shift->{results}}; }
Subroutine results: called CC=1 SCAR=0.0
Pod undocumented
97 1 ▶sub results_code { return map { $_->{code} } shift->results(); }
Subroutine results_code: called CC=1 SCAR=0.0
Pod undocumented
98 1 ▶sub results_message { return map { $_->{message} } shift->results(); }
Subroutine results_message: called CC=1 SCAR=0.0
Pod undocumented
99 1 ▶sub results_lang { return map { $_->{lang} } shift->results(); }
Subroutine results_lang: called CC=1 SCAR=0.0
Pod undocumented
100 0 ▶sub results_extra_info { return map { $_->{extra_info} } shift->results(); }
Subroutine results_extra_info: not called CC=1 SCAR=6.9
Pod undocumented
101  
102 0 ▶sub result_is { my ($self,$code)=@_; return Net::DRI::Protocol::ResultStatus::is($self->_get_result('code'),$code); }
Subroutine result_is: not called CC=1 SCAR=6.9
Pod undocumented
103 3 ▶sub result_code { my ($self,@args)=@_; return $self->_get_result('code',@args); }
Subroutine result_code: called CC=1 SCAR=0.0
Pod undocumented
104 1 ▶sub result_message { my ($self,@args)=@_; return $self->_get_result('message',@args); }
Subroutine result_message: called CC=1 SCAR=0.0
Pod undocumented
105 1 ▶sub result_lang { my ($self,@args)=@_; return $self->_get_result('lang',@args); }
Subroutine result_lang: called CC=1 SCAR=0.0
Pod undocumented
106 3 ▶sub result_extra_info { my ($self,@args)=@_; return $self->_get_result('extra_info',@args); }
Subroutine result_extra_info: called CC=1 SCAR=0.0
Pod undocumented
107  
108 sub ns
109 15 ▶{
Subroutine ns: called CC=7 SCAR=20.0
Pod undocumented
110 15 my ($self, $ns) = @_;
111 15 ▶ return $self->{ns} unless defined $ns;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ns 0 15 15
112  
113 15 ▶ if (! ref $ns)
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $ns) 5 10 15
114 {
115 5 ▶ return unless exists $self->{ns}->{$ns};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"ns"}{$ns} 0 5 5
116 5 return $self->{ns}->{$ns};
117 }
118  
119 10 foreach my $alias (keys %$ns)
120 {
121 11 ▶ my $newns = ref $ns->{$alias} ? $ns->{$alias}->[0] : $ns->{$alias}; # the ref case is for old content that did not migrate to no XSD
Branch: 1 branch
BranchTrueFalseTotal
ref $ns->{$alias} ? : 0 11 11
122 11 ▶ Net::DRI::Exception->die(0,'protocol/EPP',1,sprintf('Duplicate namespace definition for "%s": previous="%s" new="%s"', $alias, $self->{ns}->{$alias}, $newns)) if exists $self->{ns}->{$alias};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"ns"}{$alias} 0 11 11
123 11 $self->{ns}->{$alias} = $newns;
124 }
125  
126 10 return $self->{ns};
127 }
128  
129 sub nsattrs
130 6 ▶{
Subroutine nsattrs: called CC=7 SCAR=21.8
Pod undocumented
131 6 my ($self,$what)=@_;
132 6 ▶ return unless defined $what;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $what 0 6 6
133 0 ▶ my @d=sort { $a cmp $b } grep { defined $_ && exists $self->{ns}->{$_} } (ref $what eq 'ARRAY' ? @$what : ($what));
Branch: 1 branch
BranchTrueFalseTotal
ref $what eq 'ARRAY' ? : 0 6 6
Condition33%1/3
defined $_ && exists $self->{'ns'}{$_}
!ll&&!rl&&r
006
MC/DC0%0/2
defined $_ && exists $self->{'ns'}{$_}
defined $_ exists $self->{'ns'}{$_}
Truth table33%1/3
A && B
A= defined $_B= exists $self->{'ns'}{$_}
ABresult
0X0
100
111
134 6 ▶ return unless @d;
Branch: 1 branch
BranchTrueFalseTotal
unless @d 0 6 6
135  
136 6 my @xns;
137 6 foreach my $rdd (@d)
138 {
139 6 ▶ push @xns, $rdd eq 'epp' ? sprintf('xmlns="%s"', $self->{ns}->{$rdd}) : sprintf('xmlns:%s="%s"', $rdd, $self->{ns}->{$rdd});
Branch: 1 branch
BranchTrueFalseTotal
$rdd eq 'epp' ? : 6 0 6
140 }
141 6 return join(' ',@xns);
142 }
143  
144 0 ▶sub is_success { return _is_success(shift->result_code()); }
Subroutine is_success: not called CC=1 SCAR=6.9
Pod undocumented
145 0 ▶sub _is_success { return (shift=~m/^1/)? 1 : 0; } ## 1XXX is for success, 2XXX for failures
Subroutine _is_success: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
(shift()) =~ /^1/ ? : 0 0 0
146  
147 sub result_status
148 0 ▶{
Subroutine result_status: not called CC=2 SCAR=17.9
Pod undocumented
149 0 my ($self)=@_;
150 0 my @rs;
151  
152 0 foreach my $result (@{$self->{results}})
153 {
154 0 my $rs=Net::DRI::Protocol::ResultStatus->new('epp',$result->{code},undef,_is_success($result->{code}),$result->{message},$result->{lang},$result->{extra_info});
155 0 $rs->_set_trid([ $self->cltrid(),$self->svtrid() ]);
156 0 push @rs,$rs;
157 }
158 0 return Net::DRI::Util::link_rs(@rs);
159 }
160  
161 sub command_extension
162 0 ▶{
Subroutine command_extension: not called CC=3 SCAR=24.8
Pod undocumented
163 0 my ($self, $ns, $rdata)=@_;
164  
165 0 ▶ $self->{extension} = {} unless exists $self->{extension};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"extension"} 0 0 0
166  
167 0 ▶ $ns = [ $ns ] unless ref $ns eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $ns eq "ARRAY" 0 0 0
168 0 $self->{extension}->{$ns->[0]} = [ {map { 'xmlns:'.$_ => $self->{ns}->{$_} } @$ns} , @$rdata ];
169  
170 0 return $self;
171 }
172  
173 sub as_string
174 6 ▶{
Subroutine as_string: called CC=25 SCAR=47.0
Pod undocumented
175 6 my ($self,$protect)=@_;
176 6 my @d;
177 6 push @d,'<?xml version="1.0" encoding="UTF-8" standalone="no"?>';
178 6 push @d,'<epp '.$self->nsattrs('epp').'>';
179  
180 6 my ($cmd,$ocmd,$ons);
181 6 my $rc=$self->command();
182 6 ▶ ($cmd,$ocmd,$ons)=@$rc if (defined $rc && ref $rc);
Branch: 1 branch
BranchTrueFalseTotal
if defined $rc and ref $rc 6 0 6
Condition33%1/3
defined $rc and ref $rc
!ll&&!rl&&r
006
MC/DC0%0/2
defined $rc and ref $rc
defined $rc ref $rc
Truth table33%1/3
A and B
A= defined $rcB= ref $rc
ABresult
0X0
100
111
183  
184 6 my $attr='';
185 0 ▶ ($cmd,$attr)=($cmd->[0],' '.join(' ',map { $_.'="'.$cmd->[1]->{$_}.'"' } sort { $a cmp $b } keys(%{$cmd->[1]}))) if (defined $cmd && ref $cmd);
Branch: 1 branch
BranchTrueFalseTotal
if defined $cmd and ref $cmd 0 6 6
Condition33%1/3
defined $cmd and ref $cmd
!ll&&!rl&&r
060
MC/DC0%0/2
defined $cmd and ref $cmd
defined $cmd ref $cmd
Truth table33%1/3
A and B
A= defined $cmdB= ref $cmd
ABresult
0X0
100
111
186  
187 6 ▶ if (defined $cmd)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $cmd) 6 0 6
188 {
189 6 ▶ push @d,'<command>' if ($cmd ne 'hello');
Branch: 1 branch
BranchTrueFalseTotal
if $cmd ne "hello" 6 0 6
190 6 my $body=$self->command_body();
191  
192 6 ▶ if (!defined $ocmd && !defined $body)
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $ocmd || defined $body) { } 0 6 6
Condition33%1/3
defined $ocmd || defined $body
l!l&&r!l&&!r
600
MC/DC0%0/2
defined $ocmd || defined $body
defined $ocmd defined $body
Truth table33%1/3
A || B
A= defined $ocmdB= defined $body
ABresult
1X1
011
000
193 {
194 0 push @d,'<',$cmd,$attr,'/>';
195 } else
196 {
197 6 push @d,'<',$cmd,$attr,'>';
198 6 ▶ if (defined $body && length $body)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $body and length $body) { } 6 0 6
Condition33%1/3
defined $body and length $body
!ll&&!rl&&r
006
MC/DC0%0/2
defined $body and length $body
defined $body length $body
Truth table33%1/3
A and B
A= defined $bodyB= length $body
ABresult
0X0
100
111
199 {
200 6 ▶ push @d,(defined $ocmd && length $ocmd)? ('<',$ocmd,' ',$ons,'>',Net::DRI::Util::xml_write($body),'</',$ocmd,'>') : Net::DRI::Util::xml_write($body);
Branch: 1 branch
BranchTrueFalseTotal
defined $ocmd && length $ocmd ? : 6 0 6
Condition33%1/3
defined $ocmd and length $ocmd
!ll&&!rl&&r
006
MC/DC0%0/2
defined $ocmd and length $ocmd
defined $ocmd length $ocmd
Truth table33%1/3
A and B
A= defined $ocmdB= length $ocmd
ABresult
0X0
100
111
201 } else
202 {
203 0 push @d,'<',$ocmd,' ',$ons,'/>';
204 }
205 6 push @d,'</',$cmd,'>';
206 }
207 }
208  
209 ## OPTIONAL extension
210 6 my $ext=$self->{extension};
211 6 ▶ if (defined $ext && ref $ext eq 'HASH' && keys %$ext)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ext and ref $ext eq "HASH" and keys %$ext) 0 6 6
Condition33%2/6
defined $ext and ref $ext eq "HASH" and keys %$ext
!ll&&!rl&&r
600
defined $ext and ref $ext eq "HASH"
!ll&&!rl&&r
600
MC/DC0%0/3
defined $ext and ref $ext eq "HASH" and keys %$ext
defined $ext ref $ext eq "HASH" keys %$ext
Truth table25%1/4
A and B and C
A= defined $extB= ref $ext eq "HASH"C= keys %$ext
ABCresult
0XX0
10X0
1100
1111
212 {
213 0 push @d,'<extension>';
214 0 foreach my $ns (sort(keys %$ext))
215 {
216 0 my $rdata = $ext->{$ns};
217 0 push @d, Net::DRI::Util::xml_write($rdata, $ns);
218 }
219 0 push @d,'</extension>';
220 }
221  
222 ## OPTIONAL clTRID
223 6 my $cltrid=$self->cltrid();
224 6 ▶ if (defined $cmd && $cmd ne 'hello')
Branch: 1 branch
BranchTrueFalseTotal
if (defined $cmd and $cmd ne "hello") 6 0 6
Condition33%1/3
defined $cmd and $cmd ne "hello"
!ll&&!rl&&r
006
MC/DC0%0/2
defined $cmd and $cmd ne "hello"
defined $cmd $cmd ne "hello"
Truth table33%1/3
A and B
A= defined $cmdB= $cmd ne "hello"
ABresult
0X0
100
111
225 {
226 6 ▶ push @d,'<clTRID>',$cltrid,'</clTRID>' if (defined $cltrid && Net::DRI::Util::xml_is_token($cltrid,3,64));
Branch: 1 branch
BranchTrueFalseTotal
if defined $cltrid and Net::DRI::Util::xml_is_token($cltrid, 3, 64) 6 0 6
Condition33%1/3
defined $cltrid and Net::DRI::Util::xml_is_token($cltrid, 3, 64)
!ll&&!rl&&r
006
MC/DC0%0/2
defined $cltrid and Net::DRI::Util::xml_is_token($cltrid, 3, 64)
defined $cltrid Net::DRI::Util::xml_is_token($cltrid, 3, 64)
Truth table33%1/3
A and B
A= defined $cltridB= Net::DRI::Util::xml_is_token($cltrid, 3, 64)
ABresult
0X0
100
111
227 6 push @d,'</command>';
228 }
229 6 push @d,'</epp>';
230  
231 6 my $msg=join('',@d);
232  
233 6 ▶ if (defined $protect && ref $protect eq 'HASH')
Branch: 1 branch
BranchTrueFalseTotal
if (defined $protect and ref $protect eq "HASH") 0 6 6
Condition33%1/3
defined $protect and ref $protect eq "HASH"
!ll&&!rl&&r
600
MC/DC0%0/2
defined $protect and ref $protect eq "HASH"
defined $protect ref $protect eq "HASH"
Truth table33%1/3
A and B
A= defined $protectB= ref $protect eq "HASH"
ABresult
0X0
100
111
234 {
235 0 ▶ if (exists $protect->{session_password} && $protect->{session_password})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $protect->{"session_password"} and $protect->{"session_password"}) 0 0 0
Condition0%0/3
exists $protect->{"session_password"} and $protect->{"session_password"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $protect->{"session_password"} and $protect->{"session_password"}
exists $protect->{"session_password"} $protect->{"session_password"}
Truth table0%0/3
A and B
A= exists $protect->{"session_password"}B= $protect->{"session_password"}
ABresult
0X0
100
111
236 {
237 0 $msg=~s#(?<=</clID>)<pw>(\S+?)</pw>#'<pw>'.('*' x length $1).'</pw>'#e;
238 0 $msg=~s#(?<=</pw>)<newPW>(\S+?)</newPW>#'<newPW>'.('*' x length $1).'</newPW>'#e;
239 }
240 }
241  
242 6 return $msg;
243 }
244  
245 1 ▶sub get_response { my ($self,@args)=@_; return $self->_get_content($self->node_resdata(),@args); }
Subroutine get_response: called CC=1 SCAR=0.0
Pod undocumented
246 0 ▶sub get_extension { my ($self,@args)=@_; return $self->_get_content($self->node_extension(),@args); }
Subroutine get_extension: not called CC=1 SCAR=6.9
Pod undocumented
247  
248 sub _get_content
249 1 ▶{
Subroutine _get_content: called CC=7 SCAR=25.1
250 1 my ($self, $node, $nstag, $nodename)=@_;
251 1 ▶ return unless defined $node && defined $nstag && length $nstag && defined $nodename && length $nodename;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $node and defined $nstag and length $nstag and defined $nodename and length $nodename 0 1 1
Condition33%4/12
defined $node and defined $nstag and length $nstag and defined $nodename and length $nodename
!ll&&!rl&&r
001
defined $node and defined $nstag and length $nstag and defined $nodename
!ll&&!rl&&r
001
defined $node and defined $nstag and length $nstag
!ll&&!rl&&r
001
defined $node and defined $nstag
!ll&&!rl&&r
001
MC/DC0%0/5
defined $node and defined $nstag and length $nstag and defined $nodename and length $nodename
defined $node defined $nstag length $nstag defined $nodename length $nodename
Truth table16%1/6
A and B and C and D and E
A= defined $nodeB= defined $nstagC= length $nstagD= defined $nodenameE= length $nodename
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
252 1 my @tmp=$node->getChildrenByTagNameNS($self->ns($nstag), $nodename);
253 1 ▶ return unless @tmp;
Branch: 1 branch
BranchTrueFalseTotal
unless @tmp 0 1 1
254 1 return $tmp[0];
255 }
256  
257 sub parse
258 4 ▶{
Subroutine parse: called CC=16 SCAR=41.0
Pod undocumented
259 4 my ($self,$dc,$rinfo)=@_;
260  
261 4 my $NS=$self->ns('epp');
262 4 my $parser=XML::LibXML->new();
263 4 my $doc=$parser->parse_string($dc->as_string());
264 4 my $root=$doc->getDocumentElement();
265 4 ▶ Net::DRI::Exception->die(0,'protocol/EPP',1,'Unsuccessfull parse, root element is not epp') unless ($root->localname() eq 'epp');
Branch: 1 branch
BranchTrueFalseTotal
unless $root->localname eq "epp" 0 4 4
266  
267 4 ▶ if (my $g=$root->getChildrenByTagNameNS($NS,'greeting'))
Branch: 1 branch
BranchTrueFalseTotal
if (my $g = $root->getChildrenByTagNameNS($NS, "greeting")) 0 4 4
268 {
269 0 push @{$self->{results}},{ code => 1000, message => 'Greeting message received', lang => 'en', extra_info => []}; ## fake an OK
270 0 $self->node_greeting($g->get_node(1));
271 0 return;
272 }
273  
274 4 my $c=$root->getChildrenByTagNameNS($NS,'response');
275 4 ▶ Net::DRI::Exception->die(0,'protocol/EPP',1,'Unsuccessfull parse, expected exactly one response block') unless ($c->size()==1);
Branch: 1 branch
BranchTrueFalseTotal
unless $c->size == 1 0 4 4
276  
277 ## result block(s)
278 4 my $res=$c->get_node(1);
279 4 foreach my $result ($res->getChildrenByTagNameNS($NS,'result')) ## one element if success, multiple elements if failure RFC5730 ยง2.6
280 {
281 5 push @{$self->{results}},Net::DRI::Protocol::EPP::Util::parse_node_result($result,$NS);
282 }
283  
284 4 $rinfo->{message}->{info}={ count => 0, checked_on => DateTime->now() };
285 4 $c=$res->getChildrenByTagNameNS($NS,'msgQ');
286 4 ▶ if ($c->size()) ## OPTIONAL
Branch: 1 branch
BranchTrueFalseTotal
if ($c->size) 0 4 4
287 {
288 0 my $msgq=$c->get_node(1);
289 0 my $id=$msgq->getAttribute('id'); ## id of the message that has just been retrieved and dequeued (RFC5730/RFC4930) OR id of *next* available message (RFC3730)
290 0 $rinfo->{message}->{info}->{id}=$id;
291 0 $rinfo->{message}->{info}->{count}=$msgq->getAttribute('count');
292 0 ▶ if ($msgq->hasChildNodes()) ## We will have childs only as a result of a poll request
Branch: 1 branch
BranchTrueFalseTotal
if ($msgq->hasChildNodes) 0 0 0
293 {
294 0 my %d=( id => $id );
295 0 $self->msg_id($id);
296  
297 0 my $qdate=Net::DRI::Util::xml_child_content($msgq,$NS,'qDate');
298 0 ▶ eval { $d{qdate}=DateTime::Format::ISO8601->new()->parse_datetime($qdate) if defined $qdate && length $qdate; };
Branch: 1 branch
BranchTrueFalseTotal
if defined $qdate and length $qdate 0 0 0
Condition0%0/3
defined $qdate and length $qdate
!ll&&!rl&&r
000
MC/DC0%0/2
defined $qdate and length $qdate
defined $qdate length $qdate
Truth table0%0/3
A and B
A= defined $qdateB= length $qdate
ABresult
0X0
100
111
299  
300 0 my $msg=$msgq->getChildrenByTagNameNS($NS,'msg');
301 0 ▶ if ($msg->size())
Branch: 1 branch
BranchTrueFalseTotal
if ($msg->size) 0 0 0
302 {
303 0 my $msgc=$msg->get_node(1);
304 0 ▶ $d{lang}=$msgc->getAttribute('lang') || 'en';
Condition0%0/2
$msgc->getAttribute('lang') || 'en'
l!l
00
MC/DC0%0/1
$msgc->getAttribute('lang') || 'en'
$msgc->getAttribute('lang')
Truth table0%0/2
A
A= $msgc->getAttribute('lang')
Aresult
11
00
305 0 ▶ if (grep { $_->nodeType() == 1 } $msgc->childNodes())
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_->nodeType == 1;} $msgc->childNodes) { } 0 0 0
306 {
307 0 $d{content}=$msgc->toString();
308 0 $self->node_msg($msgc);
309 } else
310 {
311 0 $d{content}=$msgc->textContent();
312 }
313 }
314 0 $rinfo->{message}->{$id}=\%d;
315 }
316 }
317  
318 4 $c=$res->getChildrenByTagNameNS($NS,'resData');
319 4 ▶ $self->node_resdata($c->get_node(1)) if ($c->size()); ## OPTIONAL
Branch: 1 branch
BranchTrueFalseTotal
if $c->size 2 2 4
320 4 $c=$res->getChildrenByTagNameNS($NS,'extension');
321 4 ▶ $self->node_extension($c->get_node(1)) if ($c->size()); ## OPTIONAL
Branch: 1 branch
BranchTrueFalseTotal
if $c->size 0 4 4
322  
323 ## trID
324 4 my $trid=$res->getChildrenByTagNameNS($NS,'trID')->get_node(1); ## we search only for <trID> as direct child of <response>, hence getChildren and not getElements !
325 4 my $tmp=Net::DRI::Util::xml_child_content($trid,$NS,'clTRID');
326 4 ▶ $self->cltrid($tmp) if defined $tmp;
Branch: 1 branch
BranchTrueFalseTotal
if defined $tmp 4 0 4
327 4 $tmp=Net::DRI::Util::xml_child_content($trid,$NS,'svTRID');
328 4 ▶ $self->svtrid($tmp) if defined $tmp;
Branch: 1 branch
BranchTrueFalseTotal
if defined $tmp 4 0 4
329 4 return;
330 }
331  
332 sub add_to_extra_info
333 0 ▶{
Subroutine add_to_extra_info: not called CC=1 SCAR=6.9
Pod undocumented
334 0 my ($self,$data)=@_;
335 0 push @{$self->{results}->[-1]->{extra_info}},$data;
336 0 return;
337 }
338  
339 ####################################################################################################
340 3 1;
« DRI/Protocol/EPP/Extensions/AusRegistry/IDN.pm ↑ Summary DRI/Protocol/EPP/Extensions/AusRegistry/KeyValue.pm »