DRI/Protocol/IRIS/Core.pm

filter: Statementstmt 46.5% 20 / 43 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 66.6% 6 / 9 Podpod 0.0% 0 / 3 totaltotal 34.6% 26 / 75 CC 11 SCAR 29.8
CC
11
Cov
34%
parse_error
42.0
parse_authentication
20.0
parse_msglang
12.0
CRAP 19.7
« DRI/Protocol/EPP/Extensions/AusRegistry/Variant.pm ↑ Summary DRI/Protocol/EPP/Extensions/CNNIC/Bundling.pm »
1 ## Domain Registry Interface, IRIS Core functions
2 ##
3 ## Copyright (c) 2008-2010 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::IRIS::Core;
16  
17 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Net::DRI::Protocol::ResultStatus;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 =pod
26  
27 =head1 NAME
28  
29 Net::DRI::Protocol::IRIS::Core - IRIS Core (RFC3981) functions for Net::DRI
30  
31 =head1 DESCRIPTION
32  
33 Please see the README file for details.
34  
35 =head1 SUPPORT
36  
37 For now, support questions should be sent to:
38  
39 E<lt>netdri@dotandco.comE<gt>
40  
41 Please also see the SUPPORT file in the distribution.
42  
43 =head1 SEE ALSO
44  
45 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
46  
47 =head1 AUTHOR
48  
49 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
50  
51 =head1 COPYRIGHT
52  
53 Copyright (c) 2008-2010 Patrick Mevzek <netdri@dotandco.com>.
54 All rights reserved.
55  
56 This program is free software; you can redistribute it and/or modify
57 it under the terms of the GNU General Public License as published by
58 the Free Software Foundation; either version 2 of the License, or
59 (at your option) any later version.
60  
61 See the LICENSE file that comes with this distribution for more details.
62  
63 =cut
64  
65 ####################################################################################################
66  
67 1 our %ERRORS=(insufficientResources => 2400,
68 invalidName => 2005,
69 invalidSearch => 2306,
70 queryNotSupported => 2101,
71 limitExceeded => 2201,
72 nameNotFound => 2303,
73 permissionDenied => 2200,
74 bagUnrecognized => 2005,
75 bagUnacceptable => 2005,
76 bagRefused => 2306,
77 );
78  
79 sub parse_msglang
80 {
81 0 ▶ my ($c,$name)=@_;
Subroutine parse_msglang: not called CC=3 SCAR=24.8
Pod undocumented
82 0 my (@i,$msg,$lang);
83 0 foreach my $sn ($c->getChildrenByTagNameNS($c->namespaceURI(),$name))
84 {
85 0 ▶ if (! defined $msg) { ($lang,$msg)=($sn->getAttribute('language'),$sn->textContent()); }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $msg) 0 0 0
86 0 push @i,sprintf('[%s] %s',$sn->getAttribute('language'),$sn->textContent());
87 }
88 0 return (\@i,$msg,$lang);
89 }
90  
91 sub parse_error
92 {
93 0 ▶ my ($node)=@_; ## $node should be a topmost <resultSet> to be able to catch all errors type
Subroutine parse_error: not called CC=6 SCAR=37.4
Pod undocumented
94  
95 0 foreach my $el (Net::DRI::Util::xml_list_children($node))
96 {
97 0 my ($name,$c)=@$el;
98 0 ▶ next if ($name eq 'answer' || $name eq 'additional');
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "answer" or $name eq "additional" 0 0 0
Condition0%0/3
$name eq "answer" or $name eq "additional"
l!l&&r!l&&!r
000
MC/DC0%0/2
$name eq "answer" or $name eq "additional"
$name eq "answer" $name eq "additional"
Truth table0%0/3
A or B
A= $name eq "answer"B= $name eq "additional"
ABresult
1X1
011
000
99 0 ▶ carp('Got unknown error <'.$name.'>, please report') unless exists($ERRORS{$name});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $Net::DRI::Protocol::IRIS::Core::ERRORS{$name} 0 0 0
100 0 my ($ri,$msg,$lang)=parse_msglang($c,'explanation');
101 ## We have only one error element at most, so break here if we found one
102 0 ▶ return Net::DRI::Protocol::ResultStatus->new('iris',$name,exists $ERRORS{$name} ? $ERRORS{$name} : 'COMMAND_FAILED',0,$msg,$lang,$ri);
Branch: 1 branch
BranchTrueFalseTotal
exists $Net::DRI::Protocol::IRIS::Core::ERRORS{$name} ? : 0 0 0
103 }
104 0 return Net::DRI::Protocol::ResultStatus->new_success();
105 }
106  
107 ## RFC4991 §6 §7
108 sub parse_authentication
109 {
110 0 ▶ my ($node)=@_; ## $node should be a topmost <resultSet> to be able to catch all errors type
Subroutine parse_authentication: not called CC=4 SCAR=30.0
Pod undocumented
111 0 my ($ri,$msg,$lang);
112  
113 0 foreach my $el (Net::DRI::Util::xml_list_children($node))
114 {
115 0 my ($name,$c)=@$el;
116 0 ▶ next unless ($name eq 'authenticationSuccess' || $name eq 'authenticationFailure');
Branch: 1 branch
BranchTrueFalseTotal
unless $name eq "authenticationSuccess" or $name eq "authenticationFailure" 0 0 0
Condition0%0/3
$name eq "authenticationSuccess" or $name eq "authenticationFailure"
l!l&&r!l&&!r
000
MC/DC0%0/2
$name eq "authenticationSuccess" or $name eq "authenticationFailure"
$name eq "authenticationSuccess" $name eq "authenticationFailure"
Truth table0%0/3
A or B
A= $name eq "authenticationSuccess"B= $name eq "authenticationFailure"
ABresult
1X1
011
000
117 0 ($ri,$msg,$lang)=parse_msglang($c,'description');
118 0 last;
119 }
120  
121 0 return ($msg,$lang,$ri);
122 }
123  
124 ####################################################################################################
125 1 1;
« DRI/Protocol/EPP/Extensions/AusRegistry/Variant.pm ↑ Summary DRI/Protocol/EPP/Extensions/CNNIC/Bundling.pm »