DRI/Protocol/EPP/Extensions/NeuLevel/WhoisType.pm

filter: Statementstmt 25.0% 13 / 52 Branchbran 0.0% 0 / 24 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 44.4% 4 / 9 Podpod 0.0% 0 / 5 totaltotal 17.8% 17 / 95 CC 16 SCAR 34.0
CC
16
Cov
16%
info_parse
56.0
add_whoistype
42.0
create
12.0
CRAP 30.1
« DRI/Protocol/EPP/Extensions/VeriSign/PremiumDomain.pm ↑ Summary DRI/Protocol/DAS/Domain.pm »
1 ## Domain Registry Interface, Neulevel EPP WhoisType (for .TEL and possibly others)
2 ##
3 ## Copyright (c) 2013 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
4 ## (c) 2013 Michael Holloway <michael@thedarkwinter.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::NeuLevel::WhoisType;
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  
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 => [ \&create, undef ],
31 update => [ \&update, undef ],
32 info => [ undef, \&info_parse ],
33 );
34  
35 0 return { 'domain' => \%tmp };
36 }
37  
38 ####################################################################################################
39  
40 sub add_whoistype
41 {
42 0 ▶ my $rd = shift;
Subroutine add_whoistype: not called CC=6 SCAR=37.4
Pod undocumented
43 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('whois_type type value must be defined') unless Net::DRI::Util::has_key($rd,'type');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($rd, "type") 0 0 0
44 0 my $wt = uc $rd->{'type'};
45 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('whois_type type value must be either Legal or Natural') unless $wt =~ m/^(?:LEGAL|NATURAL)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $wt =~ /^(?:LEGAL|NATURAL)$/ 0 0 0
46 0 ▶ my $pub = (defined $rd->{'publish'} && (lc($rd->{'publish'}) =~ m/(true|yes|1|y)/ ))?'Y':'N';
Branch: 1 branch
BranchTrueFalseTotal
defined $rd->{'publish'} && lc($rd->{'publish'}) =~ /(true|yes|1|y)/ ? : 0 0 0
Condition0%0/3
defined $rd->{"publish"} and lc($rd->{"publish"}) =~ /(true|yes|1|y)/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $rd->{"publish"} and lc($rd->{"publish"}) =~ /(true|yes|1|y)/
defined $rd->{"publish"} lc($rd->{"publish"}) =~ /(true|yes|1|y)/
Truth table0%0/3
A and B
A= defined $rd->{"publish"}B= lc($rd->{"publish"}) =~ /(true|yes|1|y)/
ABresult
0X0
100
111
47 0 ▶ return "WhoisType=$wt" . (($wt eq 'LEGAL')?'': " Publish=$pub");
Branch: 1 branch
BranchTrueFalseTotal
$wt eq 'LEGAL' ? : 0 0 0
48 }
49  
50 sub create
51 {
52 0 ▶ my ($epp,$domain,$rd)=@_;
Subroutine create: not called CC=3 SCAR=24.8
Pod undocumented
53 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('whois_type is required for domain creates') unless Net::DRI::Util::has_key($rd,'whois_type');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($rd, "whois_type") 0 0 0
54 0 my $unspec = add_whoistype($rd->{'whois_type'});
55 0 ▶ return unless defined $unspec;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $unspec 0 0 0
56 0 my $mes=$epp->message();
57 0 my $eid=$mes->command_extension_register('neulevel','extension');
58 0 $mes->command_extension($eid,['neulevel:unspec', $unspec]);
59 0 return;
60 }
61  
62 sub update
63 {
64 0 ▶ my ($epp,$domain,$todo)=@_;
Subroutine update: not called CC=3 SCAR=24.8
Pod undocumented
65 0 my $tochg=$todo->set('whois_type');
66 0 ▶ return unless defined $tochg;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $tochg 0 0 0
67 0 my $unspec = add_whoistype($tochg);
68 0 ▶ return unless defined $unspec;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $unspec 0 0 0
69 0 my $mes=$epp->message();
70 0 my $eid=$mes->command_extension_register('neulevel','extension');
71 0 $mes->command_extension($eid,['neulevel:unspec', $unspec]);
72 0 return;
73 }
74  
75 sub info_parse
76 {
77 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=7 SCAR=40.3
Pod undocumented
78 0 my $mes=$po->message();
79 0 my $infdata=$mes->get_extension('neulevel','extension');
80 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
81  
82 0 my %t;
83 my $unspec;
84 0 foreach my $el (Net::DRI::Util::xml_list_children($infdata))
85 {
86 0 my ($n,$c)=@$el;
87 0 ▶ next unless $n eq 'unspec';
Branch: 1 branch
BranchTrueFalseTotal
unless $n eq "unspec" 0 0 0
88 0 foreach my $kv (split(/ /,$c->textContent()))
89 {
90 0 my ($k,$v) = split(/=/,$kv);
91 0 ▶ $rinfo->{$otype}->{$oname}->{whois_type}->{type}=$v if $k eq 'WhoisType';
Branch: 1 branch
BranchTrueFalseTotal
if $k eq "WhoisType" 0 0 0
92 0 ▶ $rinfo->{$otype}->{$oname}->{whois_type}->{publish}=$v if $k eq 'Publish';
Branch: 1 branch
BranchTrueFalseTotal
if $k eq "Publish" 0 0 0
93 }
94 }
95  
96 0 return;
97 }
98  
99 ####################################################################################################
100 1 1;
« DRI/Protocol/EPP/Extensions/VeriSign/PremiumDomain.pm ↑ Summary DRI/Protocol/DAS/Domain.pm »