DRI/DRD/IIS.pm

filter: Statementstmt 41.6% 20 / 48 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 33.3% 6 / 18 Podpod 36.3% 4 / 11 totaltotal 30.3% 30 / 99 CC 9 SCAR 21.4
CC
9
Cov
30%
verify_duration_create
20.0
verify_duration_renew
20.0
transport_protocol_default
12.0
CRAP 8.5
« DRI/Cache.pm ↑ Summary DRI/Protocol/IRIS/Message.pm »
1 ## Domain Registry Interface, IIS (.SE) policy on reserved names for Net::DRI
2 ## Contributed by Elias Sidenbladh and Ulrich Wisser from NIC SE
3 ##
4 ## Copyright (c) 2006-2011,2013,2016 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::IIS;
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 base qw/Net::DRI::DRD/;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 ▶use DateTime::Duration;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use Net::DRI::Data::Contact::SE;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 ## Only transfer requests and queries are possible, the rest is handled "off line".
28 1 __PACKAGE__->make_exception_for_unavailable_operations(qw/domain_transfer_stop domain_transfer_accept domain_transfer_refuse domain_delete/);
29  
30 =pod
31  
32 =head1 NAME
33  
34 Net::DRI::DRD::IIS - IIS (.SE) policies for Net::DRI
35  
36 =head1 DESCRIPTION
37  
38 Please see the README file for details.
39  
40 =head1 SUPPORT
41  
42 For now, support questions should be sent to:
43  
44 E<lt>netdri@dotandco.comE<gt>
45  
46 Please also see the SUPPORT file in the distribution.
47  
48 =head1 SEE ALSO
49  
50 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
51  
52 =head1 AUTHOR
53  
54 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
55  
56 =head1 COPYRIGHT
57  
58 Copyright (c) 2006-2011,2013,2016 Patrick Mevzek <netdri@dotandco.com>.
59 All rights reserved.
60  
61 This program is free software; you can redistribute it and/or modify
62 it under the terms of the GNU General Public License as published by
63 the Free Software Foundation; either version 2 of the License, or
64 (at your option) any later version.
65  
66 See the LICENSE file that comes with this distribution for more details.
67  
68 =cut
69  
70 ####################################################################################################
71  
72 sub new
73 {
74 0 ▶ my $class=shift;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
75 0 my $self=$class->SUPER::new(@_);
76 0 $self->{info}->{host_as_attr}=0;
77 0 return $self;
78 }
79  
80 0 ▶sub name { return 'IIS'; }
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
81 0 ▶sub tlds { return ('se','nu'); }
Subroutine tlds: not called CC=1 SCAR=6.9
Pod documented
82 0 ▶sub periods { return map { DateTime::Duration->new(months => $_) } (12..120); }
Subroutine periods: not called CC=1 SCAR=6.9
Pod documented
83 0 ▶sub object_types { return ('domain','contact','ns'); }
Subroutine object_types: not called CC=1 SCAR=6.9
Pod documented
84 0 ▶sub profile_types { return qw/epp whois/; }
Subroutine profile_types: not called CC=1 SCAR=6.9
Pod undocumented
85  
86 sub transport_protocol_default
87 {
88 0 ▶ my ($self,$type)=@_;
Subroutine transport_protocol_default: not called CC=3 SCAR=24.8
Pod undocumented
89  
90 0 ▶ return ('Net::DRI::Transport::Socket',{},'Net::DRI::Protocol::EPP::Extensions::SE',{}) if $type eq 'epp';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "epp" 0 0 0
91 0 ▶ return ('Net::DRI::Transport::Socket',{remote_host=>'whois.nic-se.se'},'Net::DRI::Protocol::Whois',{}) if $type eq 'whois';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "whois" 0 0 0
92 0 return;
93 }
94  
95 sub set_factories
96 {
97 0 ▶ my ($self,$po)=@_;
Subroutine set_factories: not called CC=1 SCAR=6.9
Pod undocumented
98 0 ▶ $po->factories('contact',sub { return Net::DRI::Data::Contact::SE->new(@_); });
Subroutine __ANON__: not called CC=1 SCAR=6.9
99 0 return;
100 }
101  
102 ####################################################################################################
103  
104 sub verify_name_domain
105 {
106 0 ▶ my ($self,$ndr,$domain,$op)=@_;
Subroutine verify_name_domain: not called CC=1 SCAR=6.9
Pod undocumented
107 0 return $self->_verify_name_rules($domain,$op,{check_name => 1,
108 my_tld => 1,
109 });
110 }
111  
112 sub verify_duration_create
113 {
114 0 ▶ my ($self,$ndr,$duration,$domain)=@_;
Subroutine verify_duration_create: not called CC=4 SCAR=30.0
Pod undocumented
115  
116 0 ▶ return 0 unless defined $duration;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $duration 0 0 0
117  
118 0 my $m=$duration->in_units('months');
119 0 ▶ return ($m >= 12 && $m <= 120 )? 0 : 1; ## Only 12 - 120 months allowed
Branch: 1 branch
BranchTrueFalseTotal
$m >= 12 && $m <= 120 ? : 0 0 0
Condition0%0/3
$m >= 12 and $m <= 120
!ll&&!rl&&r
000
MC/DC0%0/2
$m >= 12 and $m <= 120
$m >= 12 $m <= 120
Truth table0%0/3
A and B
A= $m >= 12B= $m <= 120
ABresult
0X0
100
111
120 }
121  
122 sub verify_duration_renew
123 {
124 0 ▶ my ($self,$ndr,$duration,$domain,$curexp)=@_;
Subroutine verify_duration_renew: not called CC=4 SCAR=30.0
Pod undocumented
125  
126 0 ▶ return 0 unless defined $duration;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $duration 0 0 0
127  
128 0 my $m=$duration->in_units('months');
129 0 ▶ return ($m >= 12 && $m <= 120 )? 0 : 1; ## Only 12 - 120 months allowed
Branch: 1 branch
BranchTrueFalseTotal
$m >= 12 && $m <= 120 ? : 0 0 0
Condition0%0/3
$m >= 12 and $m <= 120
!ll&&!rl&&r
000
MC/DC0%0/2
$m >= 12 and $m <= 120
$m >= 12 $m <= 120
Truth table0%0/3
A and B
A= $m >= 12B= $m <= 120
ABresult
0X0
100
111
130 }
131  
132 ####################################################################################################
133 1 1;
« DRI/Cache.pm ↑ Summary DRI/Protocol/IRIS/Message.pm »