File Coverage

blib/lib/Net/DRI/DRD/SE.pm
Criterion Covered Total %
statement 18 46 39.1
branch 0 12 0.0
condition 0 6 0.0
subroutine 6 18 33.3
pod 4 11 36.3
total 28 93 30.1


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, .SE policy on reserved names
2             ## Contributed by Elias Sidenbladh and Ulrich Wisser from NIC SE
3             ##
4             ## Copyright (c) 2006-2011,2013 Patrick Mevzek . 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::SE;
17              
18 1     1   715 use strict;
  1         2  
  1         52  
19 1     1   5 use warnings;
  1         1  
  1         28  
20              
21 1     1   4 use base qw/Net::DRI::DRD/;
  1         1  
  1         69  
22              
23 1     1   4 use DateTime::Duration;
  1         7  
  1         16  
24 1     1   3 use Net::DRI::Util;
  1         1  
  1         19  
25 1     1   423 use Net::DRI::Data::Contact::SE;
  1         3  
  1         12  
26              
27             ## Only transfer requests and queries are possible, the rest is handled "off line".
28             __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::SE - .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             Enetdri@dotandco.comE
45              
46             Please also see the SUPPORT file in the distribution.
47              
48             =head1 SEE ALSO
49              
50             Ehttp://www.dotandco.com/services/software/Net-DRI/E
51              
52             =head1 AUTHOR
53              
54             Patrick Mevzek, Enetdri@dotandco.comE
55              
56             =head1 COPYRIGHT
57              
58             Copyright (c) 2006-2011,2013 Patrick Mevzek .
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     0 0   my $class=shift;
75 0           my $self=$class->SUPER::new(@_);
76 0           $self->{info}->{host_as_attr}=0;
77 0           return $self;
78             }
79              
80 0     0 1   sub name { return 'IIS'; }
81 0     0 1   sub tlds { return ('se','nu'); }
82 0     0 1   sub periods { return map { DateTime::Duration->new(months => $_) } (12..120); }
  0            
83 0     0 1   sub object_types { return ('domain','contact','ns'); }
84 0     0 0   sub profile_types { return qw/epp whois/; }
85              
86             sub transport_protocol_default
87             {
88 0     0 0   my ($self,$type)=@_;
89              
90 0 0         return ('Net::DRI::Transport::Socket',{},'Net::DRI::Protocol::EPP::Extensions::SE',{}) if $type eq 'epp';
91 0 0         return ('Net::DRI::Transport::Socket',{remote_host=>'whois.nic-se.se'},'Net::DRI::Protocol::Whois',{}) if $type eq 'whois';
92 0           return;
93             }
94              
95             sub set_factories
96             {
97 0     0 0   my ($self,$po)=@_;
98 0     0     $po->factories('contact',sub { return Net::DRI::Data::Contact::SE->new(@_); });
  0            
99 0           return;
100             }
101              
102             ####################################################################################################
103              
104             sub verify_name_domain
105             {
106 0     0 0   my ($self,$ndr,$domain,$op)=@_;
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     0 0   my ($self,$ndr,$duration,$domain)=@_;
115              
116 0 0         return 0 unless defined $duration;
117              
118 0           my $m=$duration->in_units('months');
119 0 0 0       return ($m >= 12 && $m <= 120 )? 0 : 1; ## Only 12 - 120 months allowed
120             }
121              
122             sub verify_duration_renew
123             {
124 0     0 0   my ($self,$ndr,$duration,$domain,$curexp)=@_;
125              
126 0 0         return 0 unless defined $duration;
127              
128 0           my $m=$duration->in_units('months');
129 0 0 0       return ($m >= 12 && $m <= 120 )? 0 : 1; ## Only 12 - 120 months allowed
130             }
131              
132             ####################################################################################################
133             1;