DRI/Protocol/EPP/Extensions/PL/Message.pm

filter: Statementstmt 12.2% 10 / 82 Branchbran 0.0% 0 / 46 Conditioncond 0.0% 0 / 18 MC/DCmcdc 0.0% 0 / 12 Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 3 totaltotal 7.7% 13 / 167 CC 33 SCAR 67.9
CC
33
Cov
7%
parse_poll
1056.0
poll
6.0
register_commands
2.0
CRAP 889.7
« DRI/Protocol/EPP/Extensions/VeriSign/Suggestion.pm ↑ Summary DRI/Protocol/EPP/Extensions/AT/Message.pm »
1 ## Domain Registry Interface, .PL Message EPP extension commands
2 ##
3 ## Copyright (c) 2008 Tonnerre Lombard <tonnerre.lombard@sygroup.ch>.
4 ## Copyright (c) 2008 Thorsten Glaser for Sygroup GmbH
5 ## Copyright (c) 2010,2013 Patrick Mevzek <netdri@dotandco.com>
6 ## All rights reserved.
7 ##
8 ## This file is part of Net::DRI
9 ##
10 ## Net::DRI is free software; you can redistribute it and/or modify
11 ## it under the terms of the GNU General Public License as published by
12 ## the Free Software Foundation; either version 2 of the License, or
13 ## (at your option) any later version.
14 ##
15 ## See the LICENSE file that comes with this distribution for more details.
16 ####################################################################################################
17  
18 package Net::DRI::Protocol::EPP::Extensions::PL::Message;
19  
20 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 =pod
26  
27 =head1 NAME
28  
29 Net::DRI::Protocol::EPP::Extensions::PL::Message - .PL EPP Message extension commands for Net::DRI
30  
31 =head1 DESCRIPTION
32  
33 Please see the README file for details.
34  
35 =head1 SUPPORT
36  
37 For now, support questions should be sent to:
38  
39 E<lt>development@sygroup.chE<gt>
40  
41 Please also see the SUPPORT file in the distribution.
42  
43 =head1 SEE ALSO
44  
45 E<lt>http://oss.bsdprojects.net/project/netdri/E<gt>
46  
47 =head1 AUTHOR
48  
49 Tonnerre Lombard, E<lt>tonnerre.lombard@sygroup.chE<gt>
50 Thorsten Glaser
51  
52 =head1 COPYRIGHT
53  
54 Copyright (c) 2008 Tonnerre Lombard <tonnerre.lombard@sygroup.ch>.
55 Copyright (c) 2008 Thorsten Glaser for Sygroup GmbH
56 Copyright (c) 2010,2013 Patrick Mevzek <netdri@dotandco.com>
57 All rights reserved.
58  
59 This program is free software; you can redistribute it and/or modify
60 it under the terms of the GNU General Public License as published by
61 the Free Software Foundation; either version 2 of the License, or
62 (at your option) any later version.
63  
64 See the LICENSE file that comes with this distribution for more details.
65  
66 =cut
67  
68 ####################################################################################################
69  
70 sub register_commands
71 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
72 0 my ($class,$version)=@_;
73 0 my %tmp=(
74 plretrieve => [ \&poll, \&parse_poll ]
75 );
76  
77 0 return { 'message' => \%tmp };
78 }
79  
80 ####################################################################################################
81  
82 sub poll
83 0 ▶{
Subroutine poll: not called CC=2 SCAR=17.9
Pod undocumented
84 0 my ($epp,$msgid)=@_;
85 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('In EPP, you can not specify the message id you want to retrieve') if defined($msgid);
Branch: 1 branch
BranchTrueFalseTotal
if defined $msgid 0 0 0
86 0 my $mes=$epp->message();
87 0 $mes->command([['poll',{op=>'req'}]]);
88 0 return;
89 }
90  
91 sub parse_poll
92 0 ▶{
Subroutine parse_poll: not called CC=32 SCAR=69.6
Pod undocumented
93 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
94 0 my ($epp,$rep,$ext,$ctag,@conds,@tags);
95 0 my $mes=$po->message();
96 0 my $msgid=$mes->msg_id();
97 0 my $domname;
98 my $domauth;
99 0 my $action;
100  
101 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
102 0 ▶ return if $mes->result_is('COMMAND_SUCCESSFUL_QUEUE_EMPTY');
Branch: 1 branch
BranchTrueFalseTotal
if $mes->result_is("COMMAND_SUCCESSFUL_QUEUE_EMPTY") 0 0 0
103 0 ▶ return unless (defined($msgid) && $msgid);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $msgid and $msgid 0 0 0
Condition0%0/3
defined $msgid and $msgid
!ll&&!rl&&r
000
MC/DC0%0/2
defined $msgid and $msgid
defined $msgid $msgid
Truth table0%0/3
A and B
A= defined $msgidB= $msgid
ABresult
0X0
100
111
104  
105 0 my $mesdata = $mes->node_resdata();
106 0 ▶ return unless ($mesdata);
Branch: 1 branch
BranchTrueFalseTotal
unless $mesdata 0 0 0
107  
108 0 $rinfo->{message}->{session}->{last_id}=$msgid;
109  
110 0 foreach my $cnode ($mesdata->childNodes) {
111 0 ▶ my $cmdname = $cnode->localName || $cnode->nodeName;
Condition0%0/3
$cnode->localName || $cnode->nodeName
l!l&&r!l&&!r
000
MC/DC0%0/2
$cnode->localName || $cnode->nodeName
$cnode->localName $cnode->nodeName
Truth table0%0/3
A || B
A= $cnode->localNameB= $cnode->nodeName
ABresult
1X1
011
000
112  
113 0 ▶ if ($cmdname eq 'pollAuthInfo') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmdname eq 'pollAuthInfo') { } 0 0 0
114 0 my $ra = $rinfo->{message}->{$msgid}->{extra_info};
115 0 push @{$ra}, $cnode->toString(); ### ???
116 0 $action = 'pollAuthInfo';
117  
118 0 foreach my $cnode ($cnode->childNodes) {
119 0 ▶ my $objname = $cnode->localName || $cnode->nodeName;
Condition0%0/3
$cnode->localName || $cnode->nodeName
l!l&&r!l&&!r
000
MC/DC0%0/2
$cnode->localName || $cnode->nodeName
$cnode->localName $cnode->nodeName
Truth table0%0/3
A || B
A= $cnode->localNameB= $cnode->nodeName
ABresult
1X1
011
000
120  
121 0 ▶ if ($objname eq 'domain') {
Branch: 1 branch
BranchTrueFalseTotal
if ($objname eq "domain") 0 0 0
122 0 $otype = 'domain';
123  
124 0 foreach my $cnode ($cnode->childNodes) {
125 0 ▶ my $infname = $cnode->localName || $cnode->nodeName;
Condition0%0/3
$cnode->localName || $cnode->nodeName
l!l&&r!l&&!r
000
MC/DC0%0/2
$cnode->localName || $cnode->nodeName
$cnode->localName $cnode->nodeName
Truth table0%0/3
A || B
A= $cnode->localNameB= $cnode->nodeName
ABresult
1X1
011
000
126  
127 0 ▶ if ($infname eq 'name') {
Branch: 2 branches
BranchTrueFalseTotal
if ($infname eq 'name') { } 0 0 0
elsif ($infname eq 'authInfo') { } 0 0 0
128 0 $domname = $cnode->getFirstChild()->getData();
129 } elsif ($infname eq 'authInfo') {
130 0 $domauth = $cnode;
131 }
132 }
133 }
134 }
135 } else {
136 # copied from Net/DRI/Protocol/EPP/Core/Domain.pm:transfer_parse
137 0 my $trndata=$mes->get_response('domain','trnData');
138 0 ▶ if ($trndata) {
Branch: 1 branch
BranchTrueFalseTotal
if ($trndata) 0 0 0
139 0 my $pd=DateTime::Format::ISO8601->new();
140 0 my $c=$trndata->getFirstChild();
141 0 ▶ while ($c) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c) 0 0 0
142 0 ▶ next unless ($c->nodeType() == 1); ## only for element nodes
Branch: 1 branch
BranchTrueFalseTotal
unless $c->nodeType == 1 0 0 0
143 0 ▶ my $name=$c->localname() || $c->nodeName();
Condition0%0/3
$c->localname || $c->nodeName
l!l&&r!l&&!r
000
MC/DC0%0/2
$c->localname || $c->nodeName
$c->localname $c->nodeName
Truth table0%0/3
A || B
A= $c->localnameB= $c->nodeName
ABresult
1X1
011
000
144 0 ▶ next unless $name;
Branch: 1 branch
BranchTrueFalseTotal
unless $name 0 0 0
145  
146 0 ▶ if ($name eq 'name') {
Branch: 3 branches
BranchTrueFalseTotal
if ($name eq 'name') { } 0 0 0
elsif ($name =~ /^(trStatus|reID|acID)$/) { } 0 0 0
elsif ($name =~ /^(reDate|acDate|exDate)$/) { } 0 0 0
147 0 $domname = lc($c->getFirstChild()->getData());
148 0 $action = 'transfer';
149 } elsif ($name=~m/^(trStatus|reID|acID)$/) {
150 0 my $fc = $c->getFirstChild();
151 0 ▶ $rinfo->{domain}->{$domname}->{$1}=$fc->getData() if (defined($fc));
Branch: 1 branch
BranchTrueFalseTotal
if defined $fc 0 0 0
152 } elsif ($name=~m/^(reDate|acDate|exDate)$/) {
153 0 $rinfo->{domain}->{$domname}->{$1}=$pd->parse_datetime($c->getFirstChild()->getData());
154 }
155 0 } continue { $c=$c->getNextSibling(); }
156 }
157 }
158 }
159 0 ▶ if (defined ($domname)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $domname) 0 0 0
160 0 $otype = 'domain';
161 0 $oname = $domname;
162 0 $rinfo->{domain}->{$domname}->{name} = $domname;
163 0 $rinfo->{domain}->{$domname}->{exist} = 1;
164 0 $rinfo->{message}->{$msgid}->{object_id} = $domname;
165 0 ▶ if (defined ($domauth)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $domauth) 0 0 0
166 0 my $c = $domauth->getFirstChild();
167  
168 0 ▶ while ($c)
Branch: 1 branch
BranchTrueFalseTotal
if ($c) 0 0 0
169 {
170 0 my $typename;
171 0 ▶ next unless ($c->nodeType == 1); ## only for element nodes
Branch: 1 branch
BranchTrueFalseTotal
unless $c->nodeType == 1 0 0 0
172 0 ▶ $typename = $c->localName || $c->nodeName;
Condition0%0/3
$c->localName || $c->nodeName
l!l&&r!l&&!r
000
MC/DC0%0/2
$c->localName || $c->nodeName
$c->localName $c->nodeName
Truth table0%0/3
A || B
A= $c->localNameB= $c->nodeName
ABresult
1X1
011
000
173 $rinfo->{domain}->{$domname}->{auth} = {
174 0 $typename => $c->getFirstChild()->getData()
175 };
176 0 } continue { $c = $c->getNextSibling(); }
177 }
178 }
179 0 ▶ if (defined ($action)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $action) 0 0 0
180 0 $rinfo->{message}->{$msgid}->{action} = $action;
181 0 ▶ if (defined ($domname)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $domname) 0 0 0
182 0 $rinfo->{domain}->{$oname}->{action} = $action;
183 }
184 }
185 0 $rinfo->{message}->{$msgid}->{object_type} = $otype;
186 0 $rinfo->{$otype}->{$oname}->{message}=$mesdata;
187 0 return;
188 }
189  
190 ####################################################################################################
191 1 1;
« DRI/Protocol/EPP/Extensions/VeriSign/Suggestion.pm ↑ Summary DRI/Protocol/EPP/Extensions/AT/Message.pm »