File Coverage

blib/lib/Net/DRI/DRD/VeriSign/NAME.pm
Criterion Covered Total %
statement 28 68 41.1
branch 1 16 6.2
condition n/a
subroutine 10 21 47.6
pod 4 15 26.6
total 43 120 35.8


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, VeriSign Registry Driver for .NAME
2             ##
3             ## Copyright (c) 2007-2009,2011 HEXONET Support GmbH, www.hexonet.com, Alexander Biehl . All rights reserved
4             ## Copyright (c) 2005-2013,2016 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::VeriSign::NAME;
17              
18 2     2   1085 use strict;
  2         2  
  2         44  
19 2     2   6 use warnings;
  2         1  
  2         39  
20              
21 2     2   5 use base qw/Net::DRI::DRD/;
  2         2  
  2         510  
22              
23 2     2   9 use DateTime::Duration;
  2         3  
  2         28  
24              
25 2     2   5 use Net::DRI::Util;
  2         2  
  2         23  
26 2     2   5 use Net::DRI::Exception;
  2         2  
  2         1073  
27              
28             =pod
29              
30             =head1 NAME
31              
32             Net::DRI::DRD::VeriSign::NAME - VeriSign .NAME Registry driver for Net::DRI
33              
34             =head1 DESCRIPTION
35              
36             Please see the README file for details.
37              
38             =head1 SUPPORT
39              
40             For now, support questions should be sent to:
41              
42             Enetdri@dotandco.comE
43              
44             Please also see the SUPPORT file in the distribution.
45              
46             =head1 SEE ALSO
47              
48             Ehttp://www.dotandco.com/services/software/Net-DRI/E
49              
50             =head1 AUTHOR
51              
52             Patrick Mevzek, Enetdri@dotandco.comE
53              
54             =head1 COPYRIGHT
55              
56             Copyright (c) 2007-2009,2011 Alexander Biehl .
57             Copyright (c) 2005-2013,2016 Patrick Mevzek .
58             All rights reserved.
59              
60             This program is free software; you can redistribute it and/or modify
61             it under the terms of the GNU General Public License as published by
62             the Free Software Foundation; either version 2 of the License, or
63             (at your option) any later version.
64              
65             See the LICENSE file that comes with this distribution for more details.
66              
67             =cut
68              
69             ####################################################################################################
70              
71             sub new
72             {
73 1     1 0 2 my $class=shift;
74 1         5 my $self=$class->SUPER::new(@_);
75 1         5 $self->{info}->{host_as_attr}=0;
76 1         2 $self->{info}->{contact_i18n}=2; ## INT only
77 1         1 $self->{info}->{check_limit}=5;
78 1         2 return $self;
79             }
80              
81 0     0 1 0 sub periods { return map { DateTime::Duration->new(years => $_) } (1..10); }
  0         0  
82 1     1 1 3 sub name { return 'VeriSign::NAME'; }
83 1     1 1 4 sub tlds { return qw/name/; }
84 0     0 1 0 sub object_types { return qw/domain contact ns/; }
85 0     0 0 0 sub profile_types { return qw/epp whois/; }
86              
87             sub transport_protocol_default
88             {
89 1     1 0 1 my ($self,$type)=@_;
90              
91 1 50       55 return ('Net::DRI::Transport::Socket',{remote_host=>'nameeppote.verisign-grs.com', remote_port=>700},'Net::DRI::Protocol::EPP::Extensions::VeriSign::Platforms::NAME',{}) if $type eq 'epp';
92 0 0         return ('Net::DRI::Transport::Socket',{remote_host=>'whois.nic.name'},'Net::DRI::Protocol::Whois',{}) if $type eq 'whois';
93 0           return;
94             }
95              
96             ####################################################################################################
97              
98             sub verify_name_domain
99             {
100 0     0 0   my ($self,$ndr,$domain,$op)=@_;
101 0           return $self->_verify_name_rules($domain,$op,{check_name => 1,
102             check_name_dots => [1,2],
103             my_tld_not_strict => 1, ## we need less strict checks because in X.Y.name domain names both X and Y are variables
104             icann_reserved => 1,
105             });
106             }
107              
108             sub emailfwd_check
109             {
110 0     0 0   my ($self,$ndr,$email)=@_;
111             ## Technical syntax check of email object needed here
112 0           my $rc=$ndr->try_restore_from_cache('emailfwd',$email,'check');
113 0 0         if (! defined $rc) { $rc=$ndr->process('emailfwd','check',[$email]); }
  0            
114 0           return $rc;
115             }
116              
117             sub emailfwd_exist ## 1/0/undef
118             {
119 0     0 0   my ($self,$ndr,$email)=@_;
120             ## Technical syntax check of email object needed here
121 0           my $rc=$ndr->emailfwd_check($email);
122 0 0         return unless $rc->is_success();
123 0           return $ndr->get_info('exist');
124             }
125              
126             sub emailfwd_info
127             {
128 0     0 0   my ($self,$ndr,$email)=@_;
129             ## Technical syntax check of email object needed here
130 0           my $rc=$ndr->try_restore_from_cache('emailfwd',$email,'info');
131 0 0         if (! defined $rc) { $rc=$ndr->process('emailfwd','info',[$email]); }
  0            
132 0           return $rc;
133             }
134              
135             sub emailfwd_create
136             {
137 0     0 0   my ($self,$ndr,$email,$rd)=@_;
138             ## Technical syntax check of email object needed here
139 0           my $rc=$ndr->process('emailfwd','create',[$email,$rd]);
140 0           return $rc;
141             }
142              
143             sub emailfwd_delete
144             {
145 0     0 0   my ($self,$ndr,$email)=@_;
146             ## Technical syntax check of email object needed here
147 0           my $rc=$ndr->process('emailfwd','delete',[$email]);
148 0           return $rc;
149             }
150              
151             sub emailfwd_update
152             {
153 0     0 0   my ($self,$ndr,$email,$tochange)=@_;
154 0           my $fp=$ndr->protocol->nameversion();
155              
156             ## Technical syntax check of email object needed here
157 0           Net::DRI::Util::check_isa($tochange,'Net::DRI::Data::Changes');
158              
159 0           foreach my $t ($tochange->types())
160             {
161 0 0         next if $ndr->protocol_capable('emailfwd_update',$t);
162 0           Net::DRI::Exception->die(0,'DRD',5,'Protocol '.$fp.' is not capable of emailfwd_update/'.$t);
163             }
164              
165 0           my $rc=$ndr->process('emailfwd','update',[$email,$tochange]);
166 0           return $rc;
167             }
168              
169             sub emailfwd_renew
170             {
171 0     0 0   my ($self,$ndr,$email,$rd)=@_;
172             ## Technical syntax check of email object needed here
173 0 0         Net::DRI::Util::check_isa($rd->{duration},'DateTime::Duration') if defined($rd->{duration});
174 0 0         Net::DRI::Util::check_isa($rd->{current_expiration},'DateTime') if defined($rd->{current_expiration});
175 0           return $ndr->process('emailfwd','renew',[$email,$rd->{duration},$rd->{current_expiration}]);
176             }
177              
178             ####################################################################################################
179             1;