DRI/Protocol/Whois/Domain/EU.pm

filter: Statementstmt 27.9% 19 / 68 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 42.8% 6 / 14 Podpod 0.0% 0 / 8 totaltotal 21.7% 25 / 115 CC 13 SCAR 24.8
CC
13
Cov
21%
info_parse
30.0
parse_ns
20.0
parse_domain
12.0
CRAP 12.0
« DRI/Protocol/EPP/Extensions/EURid/IDN.pm ↑ Summary DRI/Protocol/EPP/Extensions/EURid/Message.pm »
1 ## Domain Registry Interface, Whois commands for .EU (RFC3912)
2 ##
3 ## Copyright (c) 2007,2009,2010,2013 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::Whois::Domain::EU;
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::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Net::DRI::Protocol::ResultStatus;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 1 ▶use Net::DRI::Protocol::EPP::Core::Status;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 =pod
27  
28 =head1 NAME
29  
30 Net::DRI::Protocol::Whois::Domain::EU - .EU Whois commands (RFC3912) for Net::DRI
31  
32 =head1 DESCRIPTION
33  
34 Please see the README file for details.
35  
36 =head1 SUPPORT
37  
38 For now, support questions should be sent to:
39  
40 E<lt>netdri@dotandco.comE<gt>
41  
42 Please also see the SUPPORT file in the distribution.
43  
44 =head1 SEE ALSO
45  
46 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
47  
48 =head1 AUTHOR
49  
50 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
51  
52 =head1 COPYRIGHT
53  
54 Copyright (c) 2007,2009,2010,2013 Patrick Mevzek <netdri@dotandco.com>.
55 All rights reserved.
56  
57 This program is free software; you can redistribute it and/or modify
58 it under the terms of the GNU General Public License as published by
59 the Free Software Foundation; either version 2 of the License, or
60 (at your option) any later version.
61  
62 See the LICENSE file that comes with this distribution for more details.
63  
64 =cut
65  
66 ####################################################################################################
67  
68 sub register_commands
69 {
70 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
71 0 return { 'domain' => { info => [ \&info, \&info_parse ] } };
72 }
73  
74 sub info
75 {
76 0 ▶ my ($po,$domain,$rd)=@_;
Subroutine info: not called CC=2 SCAR=17.9
Pod undocumented
77 0 my $mes=$po->message();
78 0 ▶ Net::DRI::Exception->die(1,'protocol/whois',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
79 0 $mes->command(lc $domain);
80 0 return;
81 }
82  
83 sub info_parse
84 {
85 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=5 SCAR=34.0
Pod undocumented
86 0 my $mes=$po->message();
87 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
88  
89 0 my $rr=$mes->response();
90 0 my $rd=$mes->response_raw();
91 0 ▶ die(Net::DRI::Protocol::ResultStatus->new_error('SESSION_LIMIT_EXCEEDED_CLOSING','Registry rate limiting','en')) if $rd=~m/Still in grace period, wait/;
Branch: 1 branch
BranchTrueFalseTotal
if $rd =~ /Still in grace period, wait/ 0 0 0
92 0 my ($domain,$exist)=parse_domain($po,$rr,$rd,$rinfo);
93 0 $rinfo->{domain}->{$domain}->{exist}=$exist;
94 0 $rinfo->{domain}->{$domain}->{action}='info';
95 0 ▶ $rinfo->{domain}->{$domain}->{ace}=$rr->{'IDNA Domain'}.'.eu' if exists $rr->{'IDNA Domain'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $rr->{"IDNA Domain"} 0 0 0
96  
97 0 ▶ return unless $exist;
Branch: 1 branch
BranchTrueFalseTotal
unless $exist 0 0 0
98  
99 0 parse_registrars($po,$domain,$rr,$rinfo);
100 0 parse_dates($po,$domain,$rr,$rinfo);
101 0 parse_status($po,$domain,$rr,$rinfo);
102 0 parse_ns($po,$domain,$rr,$rd,$rinfo);
103 0 return;
104 }
105  
106 sub parse_domain
107 {
108 0 ▶ my ($po,$rr,$rd,$rinfo)=@_;
Subroutine parse_domain: not called CC=3 SCAR=24.8
Pod undocumented
109 0 my $dom=lc($rr->{'Domain'}->[0]).'.eu';
110 0 ▶ my $e=(exists($rr->{'Status'}) && ($rr->{'Status'}->[0] eq 'AVAILABLE'))? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
exists $rr->{'Status'} && $rr->{'Status'}[0] eq 'AVAILABLE' ? : 0 0 0
Condition0%0/3
exists $rr->{"Status"} and $rr->{"Status"}[0] eq "AVAILABLE"
!ll&&!rl&&r
000
MC/DC0%0/2
exists $rr->{"Status"} and $rr->{"Status"}[0] eq "AVAILABLE"
exists $rr->{"Status"} $rr->{"Status"}[0] eq "AVAILABLE"
Truth table0%0/3
A and B
A= exists $rr->{"Status"}B= $rr->{"Status"}[0] eq "AVAILABLE"
ABresult
0X0
100
111
111 0 return ($dom,$e);
112 }
113  
114 sub parse_registrars
115 {
116 0 ▶ my ($po,$domain,$rr,$rinfo)=@_;
Subroutine parse_registrars: not called CC=2 SCAR=17.9
Pod undocumented
117 0 $rinfo->{domain}->{$domain}->{clName}=$rr->{'Name'}->[-1];
118 0 ▶ $rinfo->{domain}->{$domain}->{clWebsite}=$rr->{'Website'}->[-1] if exists $rr->{'Website'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $rr->{"Website"} 0 0 0
119 0 return;
120 }
121  
122 sub parse_dates
123 {
124 0 ▶ my ($po,$domain,$rr,$rinfo)=@_;
Subroutine parse_dates: not called CC=2 SCAR=17.9
Pod undocumented
125 0 ▶ return unless exists $rr->{'Registered'};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $rr->{"Registered"} 0 0 0
126 0 my $strp=$po->build_strptime_parser(pattern => '%a %b%n%d %Y', locale => 'en_US', time_zone => 'Europe/Brussels');
127 0 $rinfo->{domain}->{$domain}->{crDate}=$strp->parse_datetime($rr->{'Registered'}->[0]);
128 0 return;
129 }
130  
131 sub parse_status
132 {
133 0 ▶ my ($po,$domain,$rr,$rinfo)=@_;
Subroutine parse_status: not called CC=1 SCAR=6.9
Pod undocumented
134 0 $rinfo->{domain}->{$domain}->{status}=Net::DRI::Protocol::EPP::Core::Status->new(['ok']);
135 0 return;
136 }
137  
138 sub parse_ns
139 {
140 0 ▶ my ($po,$domain,$rr,$rd,$rinfo)=@_;
Subroutine parse_ns: not called CC=4 SCAR=30.0
Pod undocumented
141 0 my $ns=$po->create_local_object('hosts');
142 0 foreach my $l (@$rd)
143 {
144 0 ▶ next unless (($l=~m/^Nameservers:/)..($l=~m/^\s*$/));
Branch: 1 branch
BranchTrueFalseTotal
unless $l =~ /^Nameservers:/ .. $l =~ /^\s*$/ 0 0 0
145 0 $l=~s/^\s+//;
146 0 $l=~s/[)\s]+$//;
147 0 ▶ next unless length($l);
Branch: 1 branch
BranchTrueFalseTotal
unless length $l 0 0 0
148 0 $ns->add(split(/ \(?/,$l));
149 }
150 0 $rinfo->{domain}->{$domain}->{ns}=$ns;
151 0 return;
152 }
153  
154 ####################################################################################################
155 1 1;
« DRI/Protocol/EPP/Extensions/EURid/IDN.pm ↑ Summary DRI/Protocol/EPP/Extensions/EURid/Message.pm »