DRI/DRD/TCI.pm

filter: Statementstmt 34.5% 19 / 55 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 37.5% 6 / 16 Podpod 40.0% 4 / 10 totaltotal 25.4% 29 / 114 CC 13 SCAR 42.2
CC
13
Cov
23%
verify_duration_renew
156.0
transport_protocol_default
6.0
new
2.0
CRAP 68.1
« DRI/Protocol/EPP/Extensions/VerificationCode.pm ↑ Summary DRI/DRD/RESTENA.pm »
1 ## Domain Registry Interface, .XN--P1AI (РФ)/SU/RU policies
2 ##
3 ## Copyright (c) 2010-2011 Dmitry Belyavsky <beldmit@gmail.com>
4 ## 2011,2014 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::DRD::TCI;
17  
18 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 ▶use base qw/Net::DRI::DRD/;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use DateTime::Duration;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 ####################################################################################################
28  
29 sub new
30 0 ▶{
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
31 0 my $class=shift;
32 0 my $self=$class->SUPER::new(@_);
33 0 $self->{info}->{host_as_attr}=0;
34 0 return $self;
35 }
36  
37 0 ▶sub periods { return map { DateTime::Duration->new(years => $_) } (1); }
Subroutine periods: not called CC=1 SCAR=6.9
Pod documented
38 0 ▶sub name { return 'TCI'; }
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
39 0 ▶sub tlds { return ('xn--p1ai', 'su', 'ru'); }
Subroutine tlds: not called CC=1 SCAR=6.9
Pod documented
40 0 ▶sub object_types { return ('domain','contact','ns'); }
Subroutine object_types: not called CC=1 SCAR=6.9
Pod documented
41 0 ▶sub profile_types { return qw/epp/; }
Subroutine profile_types: not called CC=1 SCAR=6.9
Pod undocumented
42  
43 sub transport_protocol_default
44 0 ▶{
Subroutine transport_protocol_default: not called CC=2 SCAR=17.9
Pod undocumented
45 0 my ($self,$type)=@_;
46  
47 0 ▶ return ('Net::DRI::Transport::HTTP',{protocol_connection=>'Net::DRI::Protocol::EPP::Extensions::HTTP'},'Net::DRI::Protocol::EPP::Extensions::TCI',{}) if $type eq 'epp'; ## EPP is over HTTPS here
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "epp" 0 0 0
48 0 return;
49 }
50  
51 sub verify_duration_renew
52 0 ▶{
Subroutine verify_duration_renew: not called CC=12 SCAR=50.5
Pod undocumented
53 0 my ($self,$ndr,$duration,$domain,$curexp)=@_;
54 0 ▶ ($duration,$domain,$curexp)=($ndr,$duration,$domain) unless (defined($ndr) && $ndr && (ref($ndr) eq 'Net::DRI::Registry'));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ndr and $ndr and ref $ndr eq "Net::DRI::Registry" 0 0 0
Condition0%0/6
defined $ndr and $ndr and ref $ndr eq "Net::DRI::Registry"
!ll&&!rl&&r
000
defined $ndr and $ndr
!ll&&!rl&&r
000
MC/DC0%0/3
defined $ndr and $ndr and ref $ndr eq "Net::DRI::Registry"
defined $ndr $ndr ref $ndr eq "Net::DRI::Registry"
Truth table0%0/4
A and B and C
A= defined $ndrB= $ndrC= ref $ndr eq "Net::DRI::Registry"
ABCresult
0XX0
10X0
1100
1111
55  
56 0 my @d=$self->periods();
57 0 ▶ if (defined($duration) && @d)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $duration and @d) 0 0 0
Condition0%0/3
defined $duration and @d
!ll&&!rl&&r
000
MC/DC0%0/2
defined $duration and @d
defined $duration @d
Truth table0%0/3
A and B
A= defined $durationB= @d
ABresult
0X0
100
111
58 {
59 0 my $ok=0;
60 0 foreach my $d (@d)
61 {
62 0 ▶ next unless (0==Net::DRI::Util::compare_durations($d,$duration));
Branch: 1 branch
BranchTrueFalseTotal
unless 0 == Net::DRI::Util::compare_durations($d, $duration) 0 0 0
63 0 $ok=1;
64 0 last;
65 }
66 0 ▶ return 1 unless $ok;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 0 0 0
67  
68 0 ▶ if (defined $curexp && Net::DRI::Util::is_class($curexp,'DateTime'))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $curexp and Net::DRI::Util::is_class($curexp, "DateTime")) 0 0 0
Condition0%0/3
defined $curexp and Net::DRI::Util::is_class($curexp, "DateTime")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $curexp and Net::DRI::Util::is_class($curexp, "DateTime")
defined $curexp Net::DRI::Util::is_class($curexp, "DateTime")
Truth table0%0/3
A and B
A= defined $curexpB= Net::DRI::Util::is_class($curexp, "DateTime")
ABresult
0X0
100
111
69 {
70 0 my $maxdelta=$d[-1]+DateTime::Duration->new(days => 61);
71 0 my $newexp=$curexp+$duration; ## New expiration
72 0 my $now=DateTime->now(time_zone => $curexp->time_zone()->name());
73 0 my $cmp=DateTime->compare($newexp,$now+$maxdelta);
74 0 ▶ return 2 unless ($cmp == -1); ## we must have : curexp+duration < now + maxdelta
Branch: 1 branch
BranchTrueFalseTotal
unless $cmp == -1 0 0 0
75 }
76 }
77  
78 0 return 0; ## everything ok
79 }
80  
81 sub registrar_info
82 0 ▶{
Subroutine registrar_info: not called CC=1 SCAR=6.9
Pod undocumented
83 0 my ($self,$ndr,$reg_id)=@_;
84 0 my $rc=$ndr->process('registrar','info', [$reg_id]);
85 0 return $rc;
86 }
87  
88 sub registrar_update
89 0 ▶{
Subroutine registrar_update: not called CC=1 SCAR=6.9
Pod undocumented
90 0 my ($self,$ndr,$reg_id, $toc)=@_;
91 0 my $rc=$ndr->process('registrar','update', [$reg_id, $toc]);
92 0 return $rc;
93 }
94  
95 ####################################################################################################
96 1 1;
97  
98 =pod
99  
100 =head1 NAME
101  
102 Net::DRI::DRD::TCI - TCI (.SU/.RU/.XN--P1AI) Registry Driver for Net::DRI
103  
104 =head1 DESCRIPTION
105  
106 Please see the README file for details.
107  
108 =head1 SUPPORT
109  
110 For now, support questions should be sent to:
111  
112 E<lt>netdri@dotandco.comE<gt>
113  
114 Please also see the SUPPORT file in the distribution.
115  
116 =head1 SEE ALSO
117  
118 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
119  
120 =head1 AUTHOR
121  
122 Dmitry Belyavsky, E<lt>beldmit@gmail.comE<gt>
123 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
124  
125 =head1 COPYRIGHT
126  
127 Copyright (c) 2010-2011 Dmitry Belyavsky <beldmit@gmail.com>
128 Copyright (c) 2011,2014 Patrick Mevzek <netdri@dotandco.com>.
129 All rights reserved.
130  
131 This program is free software; you can redistribute it and/or modify
132 it under the terms of the GNU General Public License as published by
133 the Free Software Foundation; either version 2 of the License, or
134 (at your option) any later version.
135  
136 See the LICENSE file that comes with this distribution for more details.
137  
138 =cut
« DRI/Protocol/EPP/Extensions/VerificationCode.pm ↑ Summary DRI/DRD/RESTENA.pm »