DRI/Protocol/EPP/Extensions/EURid/IDN.pm

filter: Statementstmt 34.0% 16 / 47 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 5 / 10 Podpod 0.0% 0 / 4 totaltotal 29.5% 21 / 71 CC 8 SCAR 25.0
CC
8
Cov
28%
check_parse
30.0
_parse
12.0
get_names
6.0
CRAP 12.2
« DRI/Data/Hosts.pm ↑ Summary DRI/Protocol/Whois/Domain/EU.pm »
1 ## Domain Registry Interface, EURid IDN EPP extension commands
2 ##
3 ## Copyright (c) 2010,2012,2013,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::EURid::IDN;
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  
20 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Net::DRI::Protocol::EPP::Util;
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 my %tmp=(
30 create => [ undef, \&_parse ],
31 info => [ undef, \&_parse ],
32 check => [ undef, \&check_parse ],
33 renew => [ undef, \&_parse ],
34 );
35  
36 0 return { 'domain' => \%tmp };
37 }
38  
39 sub setup
40 0 ▶{
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
41 0 my ($class,$po,$version)=@_;
42 0 $po->ns({ 'idn' => 'http://www.eurid.eu/xml/epp/idn-1.0' });
43 0 return;
44 }
45  
46 ####################################################################################################
47  
48 sub get_names
49 0 ▶{
Subroutine get_names: not called CC=2 SCAR=17.9
Pod undocumented
50 0 my ($mes,$node)=@_;
51 0 my $ns=$mes->ns('idn');
52 0 my @r;
53 0 foreach my $e (Net::DRI::Util::xml_traverse($node,$ns,'name'))
54 {
55 0 push @r,[Net::DRI::Util::xml_child_content($e,$ns,'ace'),Net::DRI::Util::xml_child_content($e,$ns,'unicode')];
56 }
57  
58 0 return @r;
59 }
60  
61 sub _parse
62 0 ▶{
Subroutine _parse: not called CC=3 SCAR=24.8
63 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
64 0 my $mes=$po->message();
65 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
66  
67 0 my $data=$mes->get_extension('idn','mapping');
68 0 ▶ return unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 0 0
69  
70 0 ($rinfo->{domain}->{$oname}->{ace},$rinfo->{domain}->{$oname}->{unicode})=@{(get_names($mes,$data))[0]};
71 0 return;
72 }
73  
74 sub check_parse
75 0 ▶{
Subroutine check_parse: not called CC=5 SCAR=34.0
Pod undocumented
76 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
77 0 my $mes=$po->message();
78 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
79  
80 0 my $chkdata=$mes->get_extension('idn','mapping');
81 0 ▶ return unless defined $chkdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $chkdata 0 0 0
82  
83 0 foreach my $ra (get_names($mes,$chkdata))
84 {
85 0 my ($a,$u)=@$ra;
86 0 ▶ my $dom=exists $rinfo->{domain}->{$a} ? $a : $u;
Branch: 1 branch
BranchTrueFalseTotal
exists $rinfo->{'domain'}{$a} ? : 0 0 0
87 0 $rinfo->{domain}->{$dom}->{ace}=$a;
88 0 $rinfo->{domain}->{$dom}->{unicode}=$u;
89 }
90 0 return;
91 }
92  
93 ####################################################################################################
94 1 1;
95  
96  
97 __END__
« DRI/Data/Hosts.pm ↑ Summary DRI/Protocol/Whois/Domain/EU.pm »