DRI/Protocol/EPP/Extensions/VeriSign/WhoWas.pm

filter: Statementstmt 23.6% 13 / 55 Branchbran 0.0% 0 / 26 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 4 / 8 Podpod 0.0% 0 / 4 totaltotal 17.3% 17 / 98 CC 18 SCAR 45.1
CC
18
Cov
15%
whowas_parse
156.0
whowas_info
56.0
register_commands
2.0
CRAP 90.9
« DRI/Protocol/EPP/Extensions/AFNIC/Notifications.pm ↑ Summary DRI/Protocol/EPP/Extensions/AERO/Contact.pm »
1 ## Domain Registry Interface, VeriSign EPP WhoWas Extension
2 ##
3 ## Copyright (c) 2010,2012,2013,2016,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::VeriSign::WhoWas;
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  
23 ####################################################################################################
24  
25 sub register_commands
26 {
27 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
28  
29 0 return { 'domain' => { 'whowas' => [ \&whowas_info, \&whowas_parse ] } };
30 }
31  
32 sub setup
33 {
34 0 ▶ my ($class,$po,$version)=@_;
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
35 0 $po->ns({ 'whowas' => 'http://www.verisign.com/epp/whowas-1.0' });
36 0 return;
37 }
38  
39 ####################################################################################################
40  
41 sub whowas_info
42 {
43 0 ▶ my ($epp,$domain,$rd)=@_;
Subroutine whowas_info: not called CC=7 SCAR=40.3
Pod undocumented
44  
45 0 ▶ Net::DRI::Exception->die(1,'protocol/EPP',2,'Domain name needed') unless defined $domain && length $domain;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $domain and length $domain 0 0 0
Condition0%0/3
defined $domain and length $domain
!ll&&!rl&&r
000
MC/DC0%0/2
defined $domain and length $domain
defined $domain length $domain
Truth table0%0/3
A and B
A= defined $domainB= length $domain
ABresult
0X0
100
111
46 0 my $isroid=0;
47 0 ▶ if (index($domain,'.') > -1)
Branch: 1 branch
BranchTrueFalseTotal
if (index($domain, '.') != -1) { } 0 0 0
48 {
49 0 ▶ Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid domain name: '.$domain) unless Net::DRI::Util::is_hostname($domain);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::is_hostname($domain) 0 0 0
50 } else
51 {
52 0 ▶ Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid ROID value: '.$domain) unless Net::DRI::Util::is_roid($domain);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::is_roid($domain) 0 0 0
53 0 $isroid=1;
54 }
55 0 my $mes=$epp->message();
56 0 $mes->command(['info','whowas:info', $mes->nsattrs('whowas')]);
57 0 ▶ $mes->command_body([['whowas:type','domain'],[$isroid ? 'whowas:roid' : 'whowas:name',$domain]]);
Branch: 1 branch
BranchTrueFalseTotal
$isroid ? : 0 0 0
58 0 return;
59 }
60  
61 sub whowas_parse
62 {
63 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine whowas_parse: not called CC=12 SCAR=50.5
Pod undocumented
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 0 my $infdata=$mes->get_response('whowas','infData');
67 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
68  
69 0 my %r=(action => 'whowas', name => undef, type => undef, history => []);
70 0 foreach my $el (Net::DRI::Util::xml_list_children($infdata))
71 {
72 0 my ($name,$c)=@$el;
73 0 ▶ if ($name eq 'type')
Branch: 3 branches
BranchTrueFalseTotal
if ($name eq 'type') { } 0 0 0
elsif ($name eq 'name') { } 0 0 0
elsif ($name eq 'history') { } 0 0 0
74 {
75 0 $r{type}=$c->textContent();
76 } elsif ($name eq 'name')
77 {
78 0 $r{name}=$c->textContent();
79 } elsif ($name eq 'history')
80 {
81 0 foreach my $subel (Net::DRI::Util::xml_list_children($c))
82 {
83 0 my ($subname,$subnode)=@$subel;
84 0 ▶ next unless $subname eq 'rec';
Branch: 1 branch
BranchTrueFalseTotal
unless $subname eq "rec" 0 0 0
85 0 my %rec;
86 0 foreach my $rec (Net::DRI::Util::xml_list_children($subnode))
87 {
88 0 my ($recname,$recnode)=@$rec;
89 0 ▶ if ($recname=~m/^(?:name|newName|roid|op|clID|clName)$/)
Branch: 2 branches
BranchTrueFalseTotal
if ($recname =~ /^(?:name|newName|roid|op|clID|clName)$/) { } 0 0 0
elsif ($recname eq 'date') { } 0 0 0
90 {
91 0 $rec{$recname}=$recnode->textContent();
92 } elsif ($recname eq 'date')
93 {
94 0 $rec{$recname}=$po->parse_iso8601($recnode->textContent());
95 }
96 }
97 0 push @{$r{history}},\%rec;
98 }
99 }
100 }
101  
102 0 my $name=$r{name};
103 0 delete $r{name};
104 0 $rinfo->{$otype}->{$name}=\%r;
105 0 return;
106 }
107  
108 #########################################################################################################
109 1 1;
110  
111 __END__
112  
113 =pod
114  
115 =head1 NAME
116  
117 Net::DRI::Protocol::EPP::Extensions::VeriSign::WhoWas - VeriSign EPP WhoWas Extension for Net::DRI
118  
119 =head1 SYNOPSIS
120  
121 $dri=Net::DRI->new();
122 $dri->add_registry('VeriSign::NameStore',{client_id=>'XXXXXX');
123  
124 ...
125  
126 $dri->domain_whowas('test.tv');
127  
128 This extension is automatically loaded when using the VNDS registry driver.
129  
130 =head1 DESCRIPTION
131  
132 Please see the README file for details.
133  
134 =head1 SUPPORT
135  
136 For now, support questions should be sent to:
137  
138 E<lt>netdri@dotandco.comE<gt>
139  
140 Please also see the SUPPORT file in the distribution.
141  
142 =head1 SEE ALSO
143  
144 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
145  
146 =head1 AUTHOR
147  
148 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
149  
150 =head1 COPYRIGHT
151  
152 Copyright (c) 2010,2012,2013,2018 Patrick Mevzek <netdri@dotandco.com>.
153 All rights reserved.
154  
155 This program is free software; you can redistribute it and/or modify
156 it under the terms of the GNU General Public License as published by
157 the Free Software Foundation; either version 2 of the License, or
158 (at your option) any later version.
159  
160 See the LICENSE file that comes with this distribution for more details.
161  
162 =cut
« DRI/Protocol/EPP/Extensions/AFNIC/Notifications.pm ↑ Summary DRI/Protocol/EPP/Extensions/AERO/Contact.pm »