DRI/Protocol/EPP/Extensions/CNNIC/Bundling.pm

filter: Statementstmt 28.2% 13 / 46 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 26.6% 4 / 15 Podpod 0.0% 0 / 11 totaltotal 20.2% 17 / 84 CC 8 SCAR 29.6
CC
8
Cov
22%
parse
56.0
create
6.0
register_commands
2.0
CRAP 19.4
« DRI/Protocol/IRIS/Core.pm ↑ Summary DRI/Protocol/EPP/Extensions/IT/Domain.pm »
1 ## Domain Registry Interface, Bundling Registration Extension Mapping for EPP
2 ##
3 ## Copyright (c) 2015-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::CNNIC::Bundling;
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  
23 ####################################################################################################
24  
25 sub register_commands
26 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
27 0 my ($class,$version)=@_;
28  
29 0 state $rops = { 'domain' => { info => [ undef, \&info_parse ],
30 create => [ \&create, \&create_parse ],
31 delete => [ undef, \&delete_parse ],
32 renew => [ undef, \&renew_parse ],
33 transfer_request => [ undef, \&transfer_parse ],
34 transfer_cancel => [ undef, \&transfer_parse ],
35 transfer_answer => [ undef, \&transfer_parse ],
36 update => [ undef, \&update_parse ],
37 }
38 };
39  
40 0 return $rops;
41 }
42  
43 sub setup
44 0 ▶{
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
45 0 my ($class,$po,$version)=@_;
46 0 state $ns = { 'b-dn' => 'urn:ietf:params:xml:ns:epp:b-dn' };
47 0 $po->ns($ns);
48 0 return;
49 }
50  
51 0 ▶sub implements { return 'https://tools.ietf.org/id/draft-ietf-regext-bundling-registration-10'; }
Subroutine implements: not called CC=1 SCAR=6.9
Pod undocumented
52  
53 ####################################################################################################
54  
55 sub parse
56 0 ▶{
Subroutine parse: not called CC=7 SCAR=40.3
Pod undocumented
57 0 my ($po,$otype,$oaction,$oname,$rinfo,$topname)=@_;
58 0 my $mes=$po->message();
59 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
60  
61 0 my $data=$mes->get_extension('b-dn',$topname);
62 0 ▶ return unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 0 0
63  
64 0 $data=Net::DRI::Util::xml_traverse($data,$mes->ns('b-dn'),'bundle');
65 0 ▶ return unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 0 0
66  
67 0 foreach my $el (Net::DRI::Util::xml_list_children($data))
68 {
69 0 my ($name,$node)=@$el;
70 0 ▶ if ($name=~m/^(rdn|bdn)$/)
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^(rdn|bdn)$/) 0 0 0
71 {
72 0 my %r=(alabel => $node->textContent());
73 0 ▶ $r{ulabel}=$node->getAttribute('uLabel') if $node->hasAttribute('uLabel');
Branch: 1 branch
BranchTrueFalseTotal
if $node->hasAttribute("uLabel") 0 0 0
74 0 $rinfo->{$otype}->{$oname}->{$name}=\%r;
75 }
76 }
77  
78 0 return;
79 }
80  
81 0 ▶sub info_parse { return parse(@_,'infData'); } ## no critic (Subroutines::RequireArgUnpacking)
Subroutine info_parse: not called CC=1 SCAR=6.9
Pod undocumented
82 0 ▶sub create_parse { return parse(@_,'creData'); } ## no critic (Subroutines::RequireArgUnpacking)
Subroutine create_parse: not called CC=1 SCAR=6.9
Pod undocumented
83 0 ▶sub delete_parse { return parse(@_,'delData'); } ## no critic (Subroutines::RequireArgUnpacking)
Subroutine delete_parse: not called CC=1 SCAR=6.9
Pod undocumented
84 0 ▶sub renew_parse { return parse(@_,'renData'); } ## no critic (Subroutines::RequireArgUnpacking)
Subroutine renew_parse: not called CC=1 SCAR=6.9
Pod undocumented
85 0 ▶sub transfer_parse { return parse(@_,'trnData'); } ## no critic (Subroutines::RequireArgUnpacking)
Subroutine transfer_parse: not called CC=1 SCAR=6.9
Pod undocumented
86 0 ▶sub update_parse { return parse(@_,'upData'); } ## no critic (Subroutines::RequireArgUnpacking)
Subroutine update_parse: not called CC=1 SCAR=6.9
Pod undocumented
87  
88 sub create
89 0 ▶{
Subroutine create: not called CC=2 SCAR=17.9
Pod undocumented
90 0 my ($epp,$domain,$rp)=@_;
91 0 my $mes=$epp->message();
92  
93 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('ulabel property is mandatory for create with bundling extension') unless Net::DRI::Util::has_key($rp, 'ulabel');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($rp, "ulabel") 0 0 0
94 0 $mes->command_extension('b-dn', ['create', [ 'rdn', { uLabel => $rp->{ulabel} }, $domain]]);
95 0 return;
96 }
97  
98 ####################################################################################################
99 1 1;
100  
101 __END__
« DRI/Protocol/IRIS/Core.pm ↑ Summary DRI/Protocol/EPP/Extensions/IT/Domain.pm »