DRI/Protocol/EPP/Extensions/AT/IOptions.pm

filter: Statementstmt 33.3% 16 / 48 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 50.0% 5 / 10 Podpod 0.0% 0 / 5 totaltotal 24.4% 21 / 86 CC 12 SCAR 35.6
CC
12
Cov
24%
set_options
72.0
parse_options
30.0
register_commands
2.0
CRAP 35.1
« DRI/Data/Contact/PL.pm ↑ Summary DRI/Protocol/EPP/Extensions/COOP/Contact.pm »
1 ## Domain Registry Interface, ENUM.AT Options extension
2 ## Contributed by Michael Braunoeder from ENUM.AT <michael.braunoeder@enum.at>
3 ##
4 ## Copyright (c) 2006,2008,2013,2016,2018,2019 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
5 ##
6 ## This file is part of Net::DRI
7 ##
8 ## Net::DRI is free software; you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation; either version 2 of the License, or
11 ## (at your option) any later version.
12 ##
13 ## See the LICENSE file that comes with this distribution for more details.
14 ####################################################################################################
15  
16 package Net::DRI::Protocol::EPP::Extensions::AT::IOptions;
17  
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 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 1 ▶use feature 'state';
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 =pod
26  
27 =head1 NAME
28  
29 Net::DRI::Protocol::EPP::Extensions::AT::IOptions - ENUM.AT Options EPP Mapping 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) 2006,2008,2013,2016,2018,2019 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 sub register_commands
68 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
69 0 my ($class,$version)=@_;
70 0 my %tmp=(
71 info => [ undef, \&parse_options ],
72 update => [ \&set_options, undef ],
73 #create => [ \&set_options, undef ],
74 );
75  
76 0 return { 'domain' => \%tmp };
77 }
78  
79 sub setup
80 0 ▶{
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
81 0 my ($class,$po,$version)=@_;
82 0 state $ns = { 'ienum43' => 'http://www.enum.at/rxsd/ienum43-options-1.0',
83 };
84 0 $po->ns($ns);
85 0 return;
86 }
87  
88 0 ▶sub capabilities_add { return ('domain_update','options',['set']); }
Subroutine capabilities_add: not called CC=1 SCAR=6.9
Pod undocumented
89  
90 sub parse_options
91 0 ▶{
Subroutine parse_options: not called CC=5 SCAR=34.0
Pod undocumented
92 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
93 0 my $mes=$po->message();
94  
95 0 my $condata=$mes->get_extension('ienum43','options');
96 0 ▶ return unless $condata;
Branch: 1 branch
BranchTrueFalseTotal
unless $condata 0 0 0
97  
98 0 my @options;
99  
100 0 foreach my $el ($condata->getElementsByTagNameNS($mes->ns('ienum43'),'naptr-application'))
101 {
102 0 my %opts;
103 0 my $c=$el->getFirstChild();
104  
105 0 ▶ $opts{'naptr_application_origin'} =$el->getAttribute('origin') if (defined $el->getAttribute('origin'));
Branch: 1 branch
BranchTrueFalseTotal
if defined $el->getAttribute("origin") 0 0 0
106 0 ▶ $opts{'naptr_application_wildcard'}=$el->getAttribute('wildcard') if (defined $el->getAttribute('wildcard'));
Branch: 1 branch
BranchTrueFalseTotal
if defined $el->getAttribute("wildcard") 0 0 0
107  
108 0 push @options,\%opts;
109 }
110  
111 0 $rinfo->{domain}->{$oname}->{options}=\@options;
112 0 return;
113 }
114  
115 sub set_options
116 0 ▶{
Subroutine set_options: not called CC=8 SCAR=42.8
Pod undocumented
117 0 my ($epp,$domain,$rd)=@_;
118  
119 0 my $roptions=$rd->set('options');
120 0 ▶ return unless (defined($roptions) && (ref($roptions) eq 'HASH') && keys(%$roptions));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $roptions and ref $roptions eq "HASH" and keys %$roptions 0 0 0
Condition0%0/6
defined $roptions and ref $roptions eq "HASH" and keys %$roptions
!ll&&!rl&&r
000
defined $roptions and ref $roptions eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/3
defined $roptions and ref $roptions eq "HASH" and keys %$roptions
defined $roptions ref $roptions eq "HASH" keys %$roptions
Truth table0%0/4
A and B and C
A= defined $roptionsB= ref $roptions eq "HASH"C= keys %$roptions
ABCresult
0XX0
10X0
1100
1111
121  
122 0 my %options;
123 0 foreach my $d ('origin','wildcard')
124 {
125 0 ▶ next unless exists($roptions->{'naptr_application_'.$d});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $$roptions{'naptr_application_' . $d} 0 0 0
126 0 ▶ Net::DRI::Exception::usererr_invalid_paramaters("Option naptr_application_${d} must be of an XML boolean") unless Net::DRI::Utils::xml_is_boolean($roptions->{'naptr_application_'.$d});
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Utils::xml_is_boolean($$roptions{'naptr_application_' . $d}) 0 0 0
127 0 $options{$d}=$roptions->{'naptr_application_'.$d};
128 }
129  
130 0 ▶ return unless keys %options;
Branch: 1 branch
BranchTrueFalseTotal
unless keys %options 0 0 0
131  
132 0 $epp->message()->command_extension('ienum43',['update', ['options', ['naptr-application', \%options]]]);
133 0 return;
134 }
135  
136 ####################################################################################################
137 1 1;
« DRI/Data/Contact/PL.pm ↑ Summary DRI/Protocol/EPP/Extensions/COOP/Contact.pm »