DRI/Protocol/DAS/Domain.pm

filter: Statementstmt 35.1% 13 / 37 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 57.1% 4 / 7 Podpod 0.0% 0 / 3 totaltotal 25.0% 17 / 68 CC 10 SCAR 34.0
CC
10
Cov
23%
check_parse
56.0
check
20.0
register_commands
2.0
CRAP 29.9
« DRI/Protocol/EPP/Extensions/NeuLevel/WhoisType.pm ↑ Summary DRI/Util.pm »
1 ## Domain Registry Interface, DAS Domain commands
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::DAS::Domain;
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 =pod
24  
25 =head1 NAME
26  
27 Net::DRI::Protocol::DAS::Domain - DAS Domain commands for Net::DRI
28  
29 =head1 DESCRIPTION
30  
31 Please see the README file for details.
32  
33 =head1 SUPPORT
34  
35 For now, support questions should be sent to:
36  
37 E<lt>netdri@dotandco.comE<gt>
38  
39 Please also see the SUPPORT file in the distribution.
40  
41 =head1 SEE ALSO
42  
43 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
44  
45 =head1 AUTHOR
46  
47 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
48  
49 =head1 COPYRIGHT
50  
51 Copyright (c) 2007,2009,2010,2013 Patrick Mevzek <netdri@dotandco.com>.
52 All rights reserved.
53  
54 This program is free software; you can redistribute it and/or modify
55 it under the terms of the GNU General Public License as published by
56 the Free Software Foundation; either version 2 of the License, or
57 (at your option) any later version.
58  
59 See the LICENSE file that comes with this distribution for more details.
60  
61 =cut
62  
63 ####################################################################################################
64  
65 sub register_commands
66 {
67 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
68 0 my %tmp=(
69 check => [ \&check, \&check_parse ],
70 );
71  
72 0 return { 'domain' => \%tmp };
73 }
74  
75 sub check
76 {
77 0 ▶ my ($po,$domain,$rd)=@_;
Subroutine check: not called CC=4 SCAR=30.0
Pod undocumented
78 0 my $mes=$po->message();
79 0 ▶ Net::DRI::Exception->die(1,'protocol/DAS',2,'Domain name needed') unless $domain;
Branch: 1 branch
BranchTrueFalseTotal
unless $domain 0 0 0
80 0 ▶ Net::DRI::Exception->die(1,'protocol/DAS',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
81 0 my $tld=$po->tld();
82 0 ▶ $domain=~s/\.${tld}$// if defined $tld;
Branch: 1 branch
BranchTrueFalseTotal
if defined $tld 0 0 0
83 0 $mes->command('get');
84 0 $mes->command_param(lc($domain));
85 0 return;
86 }
87  
88 sub check_parse
89 {
90 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine check_parse: not called CC=7 SCAR=40.3
Pod undocumented
91 0 my $mes=$po->message();
92 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
93  
94 0 my $rr=$mes->response();
95 0 ▶ my $domain=(defined $po->tld())? lc($rr->{Domain}.'.'.$po->tld()) : lc($rr->{Domain});
Branch: 1 branch
BranchTrueFalseTotal
defined $po->tld ? : 0 0 0
96 0 $rinfo->{domain}->{$domain}->{action}='check';
97 0 my $s=uc($rr->{Status});
98 0 ▶ $rinfo->{domain}->{$domain}->{exist}=($s eq 'FREE' || $s eq 'AVAILABLE')? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$s eq 'FREE' || $s eq 'AVAILABLE' ? : 0 0 0
Condition0%0/3
$s eq "FREE" or $s eq "AVAILABLE"
l!l&&r!l&&!r
000
MC/DC0%0/2
$s eq "FREE" or $s eq "AVAILABLE"
$s eq "FREE" $s eq "AVAILABLE"
Truth table0%0/3
A or B
A= $s eq "FREE"B= $s eq "AVAILABLE"
ABresult
1X1
011
000
99 0 $rinfo->{domain}->{$domain}->{exist_reason}=$rr->{Status};
100 0 ▶ if (exists $rr->{'IDNA Domain'})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rr->{"IDNA Domain"}) 0 0 0
101 {
102 0 ▶ $rinfo->{domain}->{$domain}->{ace}=(defined $po->tld())? lc($rr->{'IDNA Domain'}.'.'.$po->tld()) : lc($rr->{'IDNA Domain'});
Branch: 1 branch
BranchTrueFalseTotal
defined $po->tld ? : 0 0 0
103 }
104 0 return;
105 }
106  
107 ####################################################################################################
108 1 1;
« DRI/Protocol/EPP/Extensions/NeuLevel/WhoisType.pm ↑ Summary DRI/Util.pm »