DRI/Protocol/OpenSRS/XCP/Host.pm

filter: Statementstmt 33.3% 13 / 39 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 50.0% 4 / 8 Podpod 0.0% 0 / 4 totaltotal 23.6% 17 / 72 CC 8 SCAR 23.5
CC
8
Cov
24%
registry_add
20.0
registry_check
12.0
registry_check_parse
12.0
CRAP 10.5
« DRI/Transport/SMTP.pm ↑ Summary DRI/Protocol/EPP/Extensions/CentralNic/WebForwarding.pm »
1 package Net::DRI::Protocol::OpenSRS::XCP::Host;
2 #===============================================================================
3 #
4 # FILE: Host.pm
5 #
6 # DESCRIPTION:
7 #
8 # FILES: ---
9 # BUGS: ---
10 # NOTES: ---
11 # AUTHOR: Dmitry Belyavsky (BelDmit), <beldmit@tcinet.ru>
12 # COMPANY: tcinet.ru
13 # VERSION: 1.0
14 # CREATED: 04/27/2012 04:10:40 PM MSK
15 # REVISION: ---
16 #===============================================================================
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::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 sub register_commands
25 {
26 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
27 0 my %tmp=(
28 # info => [\&info, \&info_parse ],
29 # create => [ \&create, \&create_parse ],
30 # delete => [ \&delete, ],
31 # update => [\&update, undef],
32 #
33 registry_add => [\&registry_add, ],
34 registry_check => [\&registry_check, \&registry_check_parse],
35 );
36  
37 0 return { 'nameserver' => \%tmp };
38 }
39  
40 ####################################################################################################
41 ########### Query commands
42  
43 sub registry_check
44 {
45 0 ▶ my ($xcp, $hostname, $registry) = @_;
Subroutine registry_check: not called CC=3 SCAR=24.8
Pod undocumented
46 0 my $msg=$xcp->message();
47 0 my %r = (action => 'registry_check_nameserver', object => 'nameserver');
48  
49 0 $msg->command(\%r);
50 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('Missing or bad registry') unless ($registry && $registry =~ /^\./);
Branch: 1 branch
BranchTrueFalseTotal
unless $registry and $registry =~ /^\./ 0 0 0
Condition0%0/3
$registry and $registry =~ /^\./
!ll&&!rl&&r
000
MC/DC0%0/2
$registry and $registry =~ /^\./
$registry $registry =~ /^\./
Truth table0%0/3
A and B
A= $registryB= $registry =~ /^\./
ABresult
0X0
100
111
51 0 my $attr = {fqdn => $hostname, tld => $registry};
52 0 $msg->command_attributes($attr);
53 0 return;
54 }
55  
56 sub registry_check_parse
57 {
58 0 ▶ my ($xcp,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine registry_check_parse: not called CC=3 SCAR=24.8
Pod undocumented
59 0 my $mes=$xcp->message();
60 0 ▶ return if($mes->response_code() >= 400);
Branch: 1 branch
BranchTrueFalseTotal
if $mes->response_code >= 400 0 0 0
61  
62 0 $rinfo->{nameserver}->{$oname}->{action}='registry_check_nameserver';
63 0 my $ra=$mes->response_attributes();
64  
65 0 ▶ $rinfo->{nameserver}->{$oname}->{exists} = $ra->{is_success} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$ra->{'is_success'} ? : 0 0 0
66 0 return;
67 }
68  
69 ############ Transform commands
70  
71 sub registry_add
72 {
73 0 ▶ my ($xcp, $hostname, $rd) = @_;
Subroutine registry_add: not called CC=4 SCAR=30.0
Pod undocumented
74 0 my $msg=$xcp->message();
75 0 my %r = (action => 'registry_add_ns', object => 'nameserver');
76  
77 0 $msg->command(\%r);
78 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('Missing or bad registry') unless ($rd->{tld} && $rd->{tld} =~ /^\./);
Branch: 1 branch
BranchTrueFalseTotal
unless $rd->{"tld"} and $rd->{"tld"} =~ /^\./ 0 0 0
Condition0%0/3
$rd->{"tld"} and $rd->{"tld"} =~ /^\./
!ll&&!rl&&r
000
MC/DC0%0/2
$rd->{"tld"} and $rd->{"tld"} =~ /^\./
$rd->{"tld"} $rd->{"tld"} =~ /^\./
Truth table0%0/3
A and B
A= $rd->{"tld"}B= $rd->{"tld"} =~ /^\./
ABresult
0X0
100
111
79 0 ▶ my $attr = {fqdn => $hostname, tld => $rd->{tld}, all => $rd->{all} || 0};
Condition0%0/2
$rd->{'all'} || 0
l!l
00
MC/DC0%0/1
$rd->{'all'} || 0
$rd->{'all'}
Truth table0%0/2
A
A= $rd->{'all'}
Aresult
11
00
80 0 $msg->command_attributes($attr);
81 0 return;
82 }
83  
84 1 1;
« DRI/Transport/SMTP.pm ↑ Summary DRI/Protocol/EPP/Extensions/CentralNic/WebForwarding.pm »