DRI/Protocol/EPP/Extensions/Reverse.pm

filter: Statementstmt 31.3% 16 / 51 Branchbran 0.0% 0 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 5 / 10 Podpod 0.0% 0 / 5 totaltotal 25.0% 21 / 84 CC 11 SCAR 33.2
CC
11
Cov
23%
parse
56.0
build
30.0
register_commands
2.0
CRAP 27.6
« DRI/Protocol/EPP/Extensions/US/Contact.pm ↑ Summary DRI/Protocol/EPP/Extensions/VeriSign/NameStore.pm »
1 ## Domain Registry Interface, Command Reversal Extension for EPP
2 ##
3 ## Copyright (c) 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::Extensions::Reverse;
16  
17 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use feature 'state';
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 ####################################################################################################
25  
26 sub register_commands
27 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
28 0 my ($class,$version)=@_;
29 0 state $rmcds = { 'command' => { 'reverse' => [ \&build, undef ],
30 'review_reverse' => [ undef, \&parse ],
31 }
32 };
33 0 return $rmcds;
34 }
35  
36 sub setup
37 0 ▶{
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
38 0 my ($class,$po,$version)=@_;
39 0 state $rns = { 'reverse' => 'urn:ietf:params:xml:ns:reverse-0.1' };
40 0 $po->ns($rns);
41 0 return;
42 }
43  
44 0 ▶sub implements { return 'https://tools.ietf.org/html/draft-brown-epp-reverse-00'; }
Subroutine implements: not called CC=1 SCAR=6.9
Pod undocumented
45  
46 ####################################################################################################
47  
48 sub build
49 0 ▶{
Subroutine build: not called CC=5 SCAR=34.0
Pod undocumented
50 0 my ($epp,$svtrid,$rd)=@_;
51 0 my $mes=$epp->message();
52  
53 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('svtrid of command to reverse is mandatory') unless defined $svtrid;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $svtrid 0 0 0
54 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('svtrid must be of type epp:trIDStringType') unless Net::DRI::Util::xml_is_token($svtrid, 3, 64);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::xml_is_token($svtrid, 3, 64) 0 0 0
55  
56 0 my @d;
57 0 ▶ push @d, ['reverse:reason', $rd->{reason}] if Net::DRI::Util::has_key($rd, 'reason');
Branch: 1 branch
BranchTrueFalseTotal
if Net::DRI::Util::has_key($rd, "reason") 0 0 0
58 0 ▶ push @d, ['reverse:trID', Net::DRI::Util::has_key($rd, 'trid') ? ['reverse:clTRID', $rd->{trid}] : (), ['reverse:svTRID', $svtrid]];
Branch: 1 branch
BranchTrueFalseTotal
Net::DRI::Util::has_key($rd, 'trid') ? : 0 0 0
59 0 push @d, ['reverse:clTRID', $mes->cltrid()];
60  
61 0 $epp->message()->command_extension('reverse', ['reverse', @d]);
62  
63 0 return;
64 }
65  
66 sub parse
67 0 ▶{
Subroutine parse: not called CC=7 SCAR=40.3
Pod undocumented
68 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
69 0 my $mes=$po->message();
70 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
71  
72 0 my $data=$mes->get_response('reverse','panData');
73 0 ▶ return unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 0 0
74  
75 0 foreach my $el (Net::DRI::Util::xml_list_children($data))
76 {
77 0 my ($name,$c)=@$el;
78 0 ▶ if ($name eq 'paTRID')
Branch: 2 branches
BranchTrueFalseTotal
if ($name eq 'paTRID') { } 0 0 0
elsif ($name eq 'paDate') { } 0 0 0
79 {
80 0 my $ns=$mes->ns('reverse');
81 0 $oname=Net::DRI::Util::xml_child_content($c,$ns,'svTRID');
82 0 $rinfo->{command}->{$oname}->{action}='review_reverse';
83 0 $rinfo->{command}->{$oname}->{result}=Net::DRI::Util::xml_parse_boolean($c->getAttribute('paResult'));
84 0 $rinfo->{command}->{$oname}->{svtrid}=$oname;
85 0 my $tmp=Net::DRI::Util::xml_child_content($c,$ns,'clTRID');
86 0 ▶ $rinfo->{command}->{$oname}->{trid}=$tmp if defined $tmp;
Branch: 1 branch
BranchTrueFalseTotal
if defined $tmp 0 0 0
87 } elsif ($name eq 'paDate')
88 {
89 0 $rinfo->{command}->{$oname}->{date}=$po->parse_iso8601($c->textContent());
90 }
91 }
92  
93 0 return;
94 }
95  
96 ####################################################################################################
97 1 1;
98  
99 __END__
« DRI/Protocol/EPP/Extensions/US/Contact.pm ↑ Summary DRI/Protocol/EPP/Extensions/VeriSign/NameStore.pm »