DRI/Protocol/EPP/Extensions/Reverse.pm

filter: Statementstmt 30.7% 16 / 52 Branchbran 0.0% 0 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 5 / 10 Podpod 0.0% 0 / 5 totaltotal 24.7% 21 / 85 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 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 {
28 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
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 {
38 0 ▶ my ($class,$po,$version)=@_;
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
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 {
50 0 ▶ my ($epp,$svtrid,$rd)=@_;
Subroutine build: not called CC=5 SCAR=34.0
Pod undocumented
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 my $eid=$mes->command_extension_register('reverse', 'reverse');
62 0 $mes->command_extension($eid, \@d);
63  
64 0 return;
65 }
66  
67 sub parse
68 {
69 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine parse: not called CC=7 SCAR=40.3
Pod undocumented
70 0 my $mes=$po->message();
71 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
72  
73 0 my $data=$mes->get_response('reverse','panData');
74 0 ▶ return unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 0 0
75  
76 0 foreach my $el (Net::DRI::Util::xml_list_children($data))
77 {
78 0 my ($name,$c)=@$el;
79 0 ▶ if ($name eq 'paTRID')
Branch: 2 branches
BranchTrueFalseTotal
if ($name eq 'paTRID') { } 0 0 0
elsif ($name eq 'paDate') { } 0 0 0
80 {
81 0 my $ns=$mes->ns('reverse');
82 0 $oname=Net::DRI::Util::xml_child_content($c,$ns,'svTRID');
83 0 $rinfo->{command}->{$oname}->{action}='review_reverse';
84 0 $rinfo->{command}->{$oname}->{result}=Net::DRI::Util::xml_parse_boolean($c->getAttribute('paResult'));
85 0 $rinfo->{command}->{$oname}->{svtrid}=$oname;
86 0 my $tmp=Net::DRI::Util::xml_child_content($c,$ns,'clTRID');
87 0 ▶ $rinfo->{command}->{$oname}->{trid}=$tmp if defined $tmp;
Branch: 1 branch
BranchTrueFalseTotal
if defined $tmp 0 0 0
88 } elsif ($name eq 'paDate')
89 {
90 0 $rinfo->{command}->{$oname}->{date}=$po->parse_iso8601($c->textContent());
91 }
92 }
93  
94 0 return;
95 }
96  
97 ####################################################################################################
98 1 1;
99  
100 __END__
101  
102 =pod
103  
104 =head1 NAME
105  
106 Net::DRI::Protocol::EPP::Extensions::Reverse - Command Reversal EPP Extension (draft-brown-epp-reverse-00) for Net::DRI
107  
108 =head1 DESCRIPTION
109  
110 Please see the README file for details.
111  
112 =head1 SUPPORT
113  
114 For now, support questions should be sent to:
115  
116 E<lt>netdri@dotandco.comE<gt>
117  
118 Please also see the SUPPORT file in the distribution.
119  
120 =head1 SEE ALSO
121  
122 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
123  
124 =head1 AUTHOR
125  
126 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
127  
128 =head1 COPYRIGHT
129  
130 Copyright (c) 2016,2018 Patrick Mevzek <netdri@dotandco.com>.
131 All rights reserved.
132  
133 This program is free software; you can redistribute it and/or modify
134 it under the terms of the GNU General Public License as published by
135 the Free Software Foundation; either version 2 of the License, or
136 (at your option) any later version.
137  
138 See the LICENSE file that comes with this distribution for more details.
139  
140 =cut
« DRI/Protocol/EPP/Extensions/US/Contact.pm ↑ Summary DRI/Protocol/EPP/Extensions/VeriSign/NameStore.pm »