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/DRD/CIRA.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 {
28 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
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 {
41 0 ▶ my ($class,$po,$version)=@_;
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
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 {
50 0 ▶ my ($mes,$node)=@_;
Subroutine get_names: not called CC=2 SCAR=17.9
Pod undocumented
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 {
63 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine _parse: not called CC=3 SCAR=24.8
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 {
76 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine check_parse: not called CC=5 SCAR=34.0
Pod undocumented
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__
98  
99 =pod
100  
101 =head1 NAME
102  
103 Net::DRI::Protocol::EPP::Extensions::EURid::IDN - EURid IDN EPP Extension for Net::DRI
104  
105 =head1 DESCRIPTION
106  
107 Please see the README file for details.
108  
109 =head1 SUPPORT
110  
111 For now, support questions should be sent to:
112  
113 E<lt>netdri@dotandco.comE<gt>
114  
115 Please also see the SUPPORT file in the distribution.
116  
117 =head1 SEE ALSO
118  
119 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
120  
121 =head1 AUTHOR
122  
123 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
124  
125 =head1 COPYRIGHT
126  
127 Copyright (c) 2010,2012,2013,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
128 All rights reserved.
129  
130 This program is free software; you can redistribute it and/or modify
131 it under the terms of the GNU General Public License as published by
132 the Free Software Foundation; either version 2 of the License, or
133 (at your option) any later version.
134  
135 See the LICENSE file that comes with this distribution for more details.
136  
137 =cut
138  
« DRI/DRD/CIRA.pm ↑ Summary DRI/Protocol/Whois/Domain/EU.pm »