DRI/Protocol/EPP/Extensions/CentralNic/TTL.pm

filter: Statementstmt 38.2% 13 / 34 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 18 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 50.0% 4 / 8 Podpod 0.0% 0 / 4 totaltotal 19.7% 17 / 86 CC 14 SCAR 33.4
CC
14
Cov
20%
create
42.0
update
42.0
info_parse
20.0
CRAP 28.1
« DRI/Protocol/EPP/Extensions/VeriSign/PollRGP.pm ↑ Summary DRI/Protocol/EPP/Extensions/US/Contact.pm »
1 ## Domain Registry Interface, CentralNic DNS TTL EPP extension
2 ## (http://labs.centralnic.com/epp/ext/ttl.php)
3 ##
4 ## Copyright (c) 2007,2008,2010,2013,2016,2019 Patrick Mevzek <netdri@dotandco.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::CentralNic::TTL;
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 DateTime::Duration;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 =pod
26  
27 =head1 NAME
28  
29 Net::DRI::Protocol::EPP::Extensions::CentralNic::TTL - EPP DNS TTL CentralNic extension commands for Net::DRI
30  
31 =head1 DESCRIPTION
32  
33 Please see the README file for details.
34  
35 =head1 SUPPORT
36  
37 For now, support questions should be sent to:
38  
39 E<lt>netdri@dotandco.comE<gt>
40  
41 Please also see the SUPPORT file in the distribution.
42  
43 =head1 SEE ALSO
44  
45 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
46  
47 =head1 AUTHOR
48  
49 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
50  
51 =head1 COPYRIGHT
52  
53 Copyright (c) 2007,2008,2010,2013,2016,2019 Patrick Mevzek <netdri@dotandco.com>.
54 All rights reserved.
55  
56 This program is free software; you can redistribute it and/or modify
57 it under the terms of the GNU General Public License as published by
58 the Free Software Foundation; either version 2 of the License, or
59 (at your option) any later version.
60  
61 See the LICENSE file that comes with this distribution for more details.
62  
63 =cut
64  
65 ####################################################################################################
66  
67 sub register_commands
68 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
69 0 my ($class,$version)=@_;
70 0 my %tmp=( create => [ \&create ],
71 update => [ \&update ],
72 info => [ undef, \&info_parse ],
73 );
74 0 return { 'domain' => \%tmp };
75 }
76  
77 ####################################################################################################
78 ########### Query commands
79  
80 sub info_parse
81 0 ▶{
Subroutine info_parse: not called CC=4 SCAR=30.0
Pod undocumented
82 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
83 0 my $mes=$po->message();
84 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
85  
86 0 my $infdata=$mes->get_extension('ttl','infData');
87 0 ▶ return unless $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless $infdata 0 0 0
88  
89 0 my @secs=$infdata->getChildrenByTagNameNS($mes->ns('ttl'),'secs');
90 0 ▶ return unless @secs;
Branch: 1 branch
BranchTrueFalseTotal
unless @secs 0 0 0
91  
92 0 $rinfo->{domain}->{$oname}->{ttl}=DateTime::Duration->new(seconds => $secs[0]->textContent());
93 0 return;
94 }
95  
96 ############ Transform commands
97  
98 sub create
99 0 ▶{
Subroutine create: not called CC=6 SCAR=37.4
Pod undocumented
100 0 my ($epp,$domain,$rd)=@_;
101  
102 0 ▶ return unless (exists($rd->{ttl}) && ((ref($rd->{ttl}) && Net::DRI::Util::is_class($rd->{ttl},'DateTime::Duration')) || $rd->{ttl}=~m/^\d+$/));
Branch: 1 branch
BranchTrueFalseTotal
unless exists $rd->{"ttl"} and ref $rd->{"ttl"} && Net::DRI::Util::is_class($rd->{"ttl"}, "DateTime::Duration") || $rd->{"ttl"} =~ /^\d+$/ 0 0 0
Condition0%0/9
exists $rd->{"ttl"} and ref $rd->{"ttl"} && Net::DRI::Util::is_class($rd->{"ttl"}, "DateTime::Duration") || $rd->{"ttl"} =~ /^\d+$/
!ll&&!rl&&r
000
ref $rd->{"ttl"} and Net::DRI::Util::is_class($rd->{"ttl"}, "DateTime::Duration") or $rd->{"ttl"} =~ /^\d+$/
l!l&&r!l&&!r
000
ref $rd->{"ttl"} and Net::DRI::Util::is_class($rd->{"ttl"}, "DateTime::Duration")
!ll&&!rl&&r
000
MC/DC0%0/4
exists $rd->{"ttl"} and ref $rd->{"ttl"} && Net::DRI::Util::is_class($rd->{"ttl"}, "DateTime::Duration") || $rd->{"ttl"} =~ /^\d+$/
exists $rd->{"ttl"} ref $rd->{"ttl"} Net::DRI::Util::is_class($rd->{"ttl"}, "DateTime::Duration") $rd->{"ttl"} =~ /^\d+$/
Truth table0%0/6
A and B and C or D
A= exists $rd->{"ttl"}B= ref $rd->{"ttl"}C= Net::DRI::Util::is_class($rd->{"ttl"}, "DateTime::Duration")D= $rd->{"ttl"} =~ /^\d+$/
ABCDresult
0XXX0
10X00
11000
111X1
10X11
11011
103  
104 0 ▶ $epp->message()->command_extension('ttl', ['create', ['secs', ref $rd->{ttl} ? $rd->{ttl}->in_units('seconds') : $rd->{ttl}]]);
Branch: 1 branch
BranchTrueFalseTotal
ref $rd->{'ttl'} ? : 0 0 0
105 0 return;
106 }
107  
108 sub update
109 0 ▶{
Subroutine update: not called CC=6 SCAR=37.4
Pod undocumented
110 0 my ($epp,$domain,$todo)=@_;
111  
112 0 my $toset=$todo->set('ttl');
113 0 ▶ return unless (defined $toset && ((ref $toset && Net::DRI::Util::is_class($toset,'DateTime::Duration')) || $toset=~m/^\d+$/));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $toset and ref $toset && Net::DRI::Util::is_class($toset, "DateTime::Duration") || $toset =~ /^\d+$/ 0 0 0
Condition0%0/9
defined $toset and ref $toset && Net::DRI::Util::is_class($toset, "DateTime::Duration") || $toset =~ /^\d+$/
!ll&&!rl&&r
000
ref $toset and Net::DRI::Util::is_class($toset, "DateTime::Duration") or $toset =~ /^\d+$/
l!l&&r!l&&!r
000
ref $toset and Net::DRI::Util::is_class($toset, "DateTime::Duration")
!ll&&!rl&&r
000
MC/DC0%0/4
defined $toset and ref $toset && Net::DRI::Util::is_class($toset, "DateTime::Duration") || $toset =~ /^\d+$/
defined $toset ref $toset Net::DRI::Util::is_class($toset, "DateTime::Duration") $toset =~ /^\d+$/
Truth table0%0/6
A and B and C or D
A= defined $tosetB= ref $tosetC= Net::DRI::Util::is_class($toset, "DateTime::Duration")D= $toset =~ /^\d+$/
ABCDresult
0XXX0
10X00
11000
111X1
10X11
11011
114  
115 0 ▶ $epp->message()->command_extension('ttl', ['update', ['secs', ref $toset ? $toset->in_units('seconds') : $toset]]);
Branch: 1 branch
BranchTrueFalseTotal
ref $toset ? : 0 0 0
116 0 return;
117 }
118  
119 ####################################################################################################
120 1 1;
« DRI/Protocol/EPP/Extensions/VeriSign/PollRGP.pm ↑ Summary DRI/Protocol/EPP/Extensions/US/Contact.pm »