DRI/Protocol/EPP/Extensions/PRO/Domain.pm

filter: Statementstmt 16.3% 10 / 61 Branchbran 0.0% 0 / 50 Conditioncond 0.0% 0 / 30 MC/DCmcdc 0.0% 0 / 20 Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 3 totaltotal 7.6% 13 / 170 CC 36 SCAR 58.0
CC
36
Cov
7%
add_pro_extinfo
420.0
parse
306.0
register_commands
2.0
CRAP 331.9
« DRI/Protocol/EPP/Extensions/PRO/AV.pm ↑ Summary DRI/Protocol/EPP/Extensions/AU/Domain.pm »
1 ## Domain Registry Interface, .PRO domain extensions
2 ##
3 ## Copyright (c) 2008 Tonnerre Lombard <tonnerre.lombard@sygroup.ch>.
4 ## (c) 2010,2013,2016 Patrick Mevzek <netdri@dotandco.com>.
5 ## All rights reserved.
6 ##
7 ## This file is part of Net::DRI
8 ##
9 ## Net::DRI is free software; you can redistribute it and/or modify
10 ## it under the terms of the GNU General Public License as published by
11 ## the Free Software Foundation; either version 2 of the License, or
12 ## (at your option) any later version.
13 ##
14 ## See the LICENSE file that comes with this distribution for more details.
15 ####################################################################################################
16  
17 package Net::DRI::Protocol::EPP::Extensions::PRO::Domain;
18  
19 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 =pod
25  
26 =head1 NAME
27  
28 Net::DRI::Protocol::EPP::Extensions::PRO::Domain - .PRO EPP domain extensions for Net::DRI
29  
30 =head1 DESCRIPTION
31  
32 Please see the README file for details.
33  
34 =head1 SUPPORT
35  
36 For now, support questions should be sent to:
37  
38 E<lt>development@sygroup.chE<gt>
39  
40 Please also see the SUPPORT file in the distribution.
41  
42 =head1 SEE ALSO
43  
44 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> and
45 E<lt>http://oss.bdsprojects.net/projects/netdri/E<gt>
46  
47 =head1 AUTHOR
48  
49 Tonnerre Lombard E<lt>tonnerre.lombard@sygroup.chE<gt>,
50 Alexander Biehl, E<lt>info@hexonet.netE<gt>, HEXONET Support GmbH,
51 E<lt>http://www.hexonet.net/E<gt>.
52  
53 =head1 COPYRIGHT
54  
55 Copyright (c) 2008 Tonnerre Lombard <tonnerre.lombard@sygroup.ch>.
56 (c) 2010,2013,2016 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 {
72 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
73 0 my %tmp=(
74 create => [ \&add_pro_extinfo ],
75 update => [ \&add_pro_extinfo ],
76 info => [ undef, \&parse ]
77 );
78  
79 0 return { 'domain' => \%tmp };
80 }
81  
82 ####################################################################################################
83 ############ Transform commands
84  
85 sub add_pro_extinfo
86 {
87 0 ▶ my ($epp, $domain, $rd) = @_;
Subroutine add_pro_extinfo: not called CC=20 SCAR=60.4
Pod undocumented
88 0 my $mes = $epp->message();
89 0 my @prodata;
90 my @tmdata;
91 0 my $pw;
92  
93 0 ▶ $rd = +{ pro => $rd->set('pro') } if Net::DRI::Util::isa_changes($rd);
Branch: 1 branch
BranchTrueFalseTotal
if Net::DRI::Util::isa_changes($rd) 0 0 0
94 0 ▶ return unless (Net::DRI::Util::has_key($rd,'pro') && (ref($rd->{pro}) eq 'HASH'));
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($rd, "pro") and ref $rd->{"pro"} eq "HASH" 0 0 0
Condition0%0/3
Net::DRI::Util::has_key($rd, "pro") and ref $rd->{"pro"} eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::has_key($rd, "pro") and ref $rd->{"pro"} eq "HASH"
Net::DRI::Util::has_key($rd, "pro") ref $rd->{"pro"} eq "HASH"
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key($rd, "pro")B= ref $rd->{"pro"} eq "HASH"
ABresult
0X0
100
111
95 0 my $ph = $rd->{pro};
96  
97 push(@prodata, ['rpro:tradeMarkName', $ph->{tmname}])
98 0 ▶ if (exists($ph->{tmname}));
Branch: 1 branch
BranchTrueFalseTotal
if exists $ph->{"tmname"} 0 0 0
99 push(@prodata, ['rpro:tradeMarkJurisdiction', $ph->{tmjurisdiction}])
100 0 ▶ if (exists($ph->{tmjurisdiction}));
Branch: 1 branch
BranchTrueFalseTotal
if exists $ph->{"tmjurisdiction"} 0 0 0
101 push(@prodata, ['rpro:tradeMarkDate', $ph->{tmdate}->strftime('%Y-%m-%dT%H:%M:%S.%1NZ')])
102 0 ▶ if (exists($ph->{tmdate}) && Net::DRI::Util::is_class($ph->{tmdate}, 'DateTime'));
Branch: 1 branch
BranchTrueFalseTotal
if exists $ph->{"tmdate"} and Net::DRI::Util::is_class($ph->{"tmdate"}, "DateTime") 0 0 0
Condition0%0/3
exists $ph->{"tmdate"} and Net::DRI::Util::is_class($ph->{"tmdate"}, "DateTime")
!ll&&!rl&&r
000
MC/DC0%0/2
exists $ph->{"tmdate"} and Net::DRI::Util::is_class($ph->{"tmdate"}, "DateTime")
exists $ph->{"tmdate"} Net::DRI::Util::is_class($ph->{"tmdate"}, "DateTime")
Truth table0%0/3
A and B
A= exists $ph->{"tmdate"}B= Net::DRI::Util::is_class($ph->{"tmdate"}, "DateTime")
ABresult
0X0
100
111
103 push(@prodata, ['rpro:tradeMarkNumber', int($ph->{tmnumber})])
104 0 ▶ if (exists($ph->{tmnumber}) && int($ph->{tmnumber}));
Branch: 1 branch
BranchTrueFalseTotal
if exists $ph->{"tmnumber"} and int $ph->{"tmnumber"} 0 0 0
Condition0%0/3
exists $ph->{"tmnumber"} and int $ph->{"tmnumber"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $ph->{"tmnumber"} and int $ph->{"tmnumber"}
exists $ph->{"tmnumber"} int $ph->{"tmnumber"}
Truth table0%0/3
A and B
A= exists $ph->{"tmnumber"}B= int $ph->{"tmnumber"}
ABresult
0X0
100
111
105  
106 push(@prodata, ['rpro:registrationType', (exists($ph->{activate}) &&
107 $ph->{activate} ? +{ activate => 'y' } : +{}), $ph->{type}])
108 0 ▶ if (exists($ph->{type}));
Branch: 2 branches
BranchTrueFalseTotal
if exists $ph->{"type"} 0 0 0
exists $ph->{'activate'} && $ph->{'activate'} ? : 0 0 0
Condition0%0/3
exists $ph->{"activate"} and $ph->{"activate"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $ph->{"activate"} and $ph->{"activate"}
exists $ph->{"activate"} $ph->{"activate"}
Truth table0%0/3
A and B
A= exists $ph->{"activate"}B= $ph->{"activate"}
ABresult
0X0
100
111
109 push(@prodata, ['rpro:redirectTarget', $ph->{redirect}])
110 if (exists($ph->{redirect}) &&
111 0 ▶ Net::DRI::Util::is_hostname($ph->{redirect}));
Branch: 1 branch
BranchTrueFalseTotal
if exists $ph->{"redirect"} and Net::DRI::Util::is_hostname($ph->{"redirect"}) 0 0 0
Condition0%0/3
exists $ph->{"redirect"} and Net::DRI::Util::is_hostname($ph->{"redirect"})
!ll&&!rl&&r
000
MC/DC0%0/2
exists $ph->{"redirect"} and Net::DRI::Util::is_hostname($ph->{"redirect"})
exists $ph->{"redirect"} Net::DRI::Util::is_hostname($ph->{"redirect"})
Truth table0%0/3
A and B
A= exists $ph->{"redirect"}B= Net::DRI::Util::is_hostname($ph->{"redirect"})
ABresult
0X0
100
111
112 0 ▶ push(@prodata, ['rpro:tradeMark', @tmdata]) if (@tmdata);
Branch: 1 branch
BranchTrueFalseTotal
if @tmdata 0 0 0
113  
114 0 ▶ if (Net::DRI::Util::has_auth($ph) && exists($ph->{auth}->{pw}))
Branch: 1 branch
BranchTrueFalseTotal
if (Net::DRI::Util::has_auth($ph) and exists $ph->{"auth"}{"pw"}) 0 0 0
Condition0%0/3
Net::DRI::Util::has_auth($ph) and exists $ph->{"auth"}{"pw"}
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::has_auth($ph) and exists $ph->{"auth"}{"pw"}
Net::DRI::Util::has_auth($ph) exists $ph->{"auth"}{"pw"}
Truth table0%0/3
A and B
A= Net::DRI::Util::has_auth($ph)B= exists $ph->{"auth"}{"pw"}
ABresult
0X0
100
111
115 {
116 0 $pw = $ph->{auth}->{pw};
117 0 delete($ph->{auth}->{pw});
118 }
119  
120 push(@prodata, ['rpro:authorization', $ph->{auth}, $pw])
121 0 ▶ if (exists($ph->{auth}));
Branch: 1 branch
BranchTrueFalseTotal
if exists $ph->{"auth"} 0 0 0
122 0 ▶ return unless (@prodata);
Branch: 1 branch
BranchTrueFalseTotal
unless @prodata 0 0 0
123  
124 0 my $eid = $mes->command_extension_register('rpro', 'proDomain');
125 0 $mes->command_extension($eid, [@prodata]);
126 0 return;
127 }
128  
129 sub parse
130 {
131 0 ▶ my ($po, $otype, $oaction, $oname, $rinfo) = @_;
Subroutine parse: not called CC=17 SCAR=57.2
Pod undocumented
132 0 my $mes = $po->message();
133 0 my $infdata = $mes->get_extension('rpro','proDomain');
134 0 my $pro = {};
135 0 my $c;
136  
137 0 ▶ return unless ($infdata);
Branch: 1 branch
BranchTrueFalseTotal
unless $infdata 0 0 0
138  
139 0 $c = $infdata->getFirstChild();
140  
141 0 ▶ while (defined($c) && $c)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $c and $c) 0 0 0
Condition0%0/3
defined $c and $c
!ll&&!rl&&r
000
MC/DC0%0/2
defined $c and $c
defined $c $c
Truth table0%0/3
A and B
A= defined $cB= $c
ABresult
0X0
100
111
142 {
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 'registrationType')
Branch: 3 branches
BranchTrueFalseTotal
if ($name eq 'registrationType') { } 0 0 0
elsif ($name eq 'redirectTarget') { } 0 0 0
elsif ($name eq 'tradeMark') { } 0 0 0
147 {
148 0 $pro->{type} = $c->getFirstChild()->getData();
149 }
150 elsif ($name eq 'redirectTarget')
151 {
152 0 $pro->{redirect} = $c->getFirstChild()->getData();
153 }
154 elsif ($name eq 'tradeMark')
155 {
156 0 my $to = $c->getFirstChild();
157  
158 0 ▶ while (defined($to) && $to)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $to and $to) 0 0 0
Condition0%0/3
defined $to and $to
!ll&&!rl&&r
000
MC/DC0%0/2
defined $to and $to
defined $to $to
Truth table0%0/3
A and B
A= defined $toB= $to
ABresult
0X0
100
111
159 {
160 0 ▶ my $totag = $to->localname() || $to->nodeName();
Condition0%0/3
$to->localname || $to->nodeName
l!l&&r!l&&!r
000
MC/DC0%0/2
$to->localname || $to->nodeName
$to->localname $to->nodeName
Truth table0%0/3
A || B
A= $to->localnameB= $to->nodeName
ABresult
1X1
011
000
161 0 ▶ next unless ($totag);
Branch: 1 branch
BranchTrueFalseTotal
unless $totag 0 0 0
162  
163 0 ▶ if ($totag eq 'tradeMarkName')
Branch: 4 branches
BranchTrueFalseTotal
if ($totag eq 'tradeMarkName') { } 0 0 0
elsif ($totag eq 'tradeMarkJurisdiction') { } 0 0 0
elsif ($totag eq 'tradeMarkDate') { } 0 0 0
elsif ($totag eq 'tradeMarkNumber') { } 0 0 0
164 {
165 $pro->{tmname} =
166 0 $to->getFirstChild()->getData();
167 }
168 elsif ($totag eq 'tradeMarkJurisdiction')
169 {
170 $pro->{tmjurisdiction} =
171 0 $to->getFirstChild()->getData();
172 }
173 elsif ($totag eq 'tradeMarkDate')
174 {
175 0 $pro->{tmdate} = $po->parse_iso8601(
176 $to->getFirstChild()->getData());
177 }
178 elsif ($totag eq 'tradeMarkNumber')
179 {
180 0 $pro->{tmnumber} = int($to->getFirstChild()->
181 getData());
182 }
183 0 } continue { $to=$to->getNextSibling(); }
184 }
185 0 } continue { $c=$c->getNextSibling(); }
186  
187 0 $rinfo->{$otype}->{$oname}->{pro} = $pro;
188 0 return;
189 }
190  
191 ####################################################################################################
192 1 1;
« DRI/Protocol/EPP/Extensions/PRO/AV.pm ↑ Summary DRI/Protocol/EPP/Extensions/AU/Domain.pm »