File Coverage

blib/lib/Net/DRI/DRD/AFNIC.pm
Criterion Covered Total %
statement 25 48 52.0
branch 1 16 6.2
condition 0 9 0.0
subroutine 9 15 60.0
pod 4 10 40.0
total 39 98 39.8


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, AFNIC Registry Driver for .FR/.RE/.TF/.YT/.WF/.PM
2             ##
3             ## Copyright (c) 2005-2006,2008-2014 Patrick Mevzek . All rights reserved.
4             ##
5             ## This file is part of Net::DRI
6             ##
7             ## Net::DRI is free software; you can redistribute it and/or modify
8             ## it under the terms of the GNU General Public License as published by
9             ## the Free Software Foundation; either version 2 of the License, or
10             ## (at your option) any later version.
11             ##
12             ## See the LICENSE file that comes with this distribution for more details.
13             ####################################################################################################
14              
15             package Net::DRI::DRD::AFNIC;
16              
17 2     2   1308 use strict;
  2         4  
  2         57  
18 2     2   8 use warnings;
  2         2  
  2         47  
19              
20 2     2   7 use base qw/Net::DRI::DRD/;
  2         70  
  2         825  
21              
22 2     2   16 use DateTime::Duration;
  2         2  
  2         34  
23 2     2   7 use Net::DRI::Util;
  2         3  
  2         788  
24              
25             __PACKAGE__->make_exception_for_unavailable_operations(qw/host_update host_current_status host_check host_exist host_delete host_create host_info contact_delete contact_check/);
26              
27             =pod
28              
29             =head1 NAME
30              
31             Net::DRI::DRD::AFNIC - AFNIC (.FR/.RE/.TF/.WF/.PM/.YT) Registry Driver for Net::DRI
32              
33             =head1 DESCRIPTION
34              
35             Please see the README file for details.
36              
37             =head1 SUPPORT
38              
39             For now, support questions should be sent to:
40              
41             Enetdri@dotandco.comE
42              
43             Please also see the SUPPORT file in the distribution.
44              
45             =head1 SEE ALSO
46              
47             Ehttp://www.dotandco.com/services/software/Net-DRI/E
48              
49             =head1 AUTHOR
50              
51             Patrick Mevzek, Enetdri@dotandco.comE
52              
53             =head1 COPYRIGHT
54              
55             Copyright (c) 2005-2006,2008-2014 Patrick Mevzek .
56             All rights reserved.
57              
58             This program is free software; you can redistribute it and/or modify
59             it under the terms of the GNU General Public License as published by
60             the Free Software Foundation; either version 2 of the License, or
61             (at your option) any later version.
62              
63             See the LICENSE file that comes with this distribution for more details.
64              
65             =cut
66              
67             ####################################################################################################
68              
69             sub new
70             {
71 1     1 0 1 my $class=shift;
72 1         7 my $self=$class->SUPER::new(@_);
73 1         8 $self->{info}->{host_as_attr}=1;
74 1         1 $self->{info}->{contact_i18n}=1; ## LOC only
75 1         2 $self->{info}->{check_limit}=7;
76 1         3 return $self;
77             }
78              
79 0     0 1 0 sub periods { return map { DateTime::Duration->new(years => $_) } (1); }
  0         0  
80 1     1 1 2 sub name { return 'AFNIC'; }
81 1     1 1 3 sub tlds { return (qw/fr re tf wf pm yt asso.fr com.fr tm.fr gouv.fr/); } ## see http://www.afnic.fr/doc/autres-nic/dom-tom
82 0     0 1 0 sub object_types { return ('domain','contact'); }
83 0     0 0 0 sub profile_types { return qw/epp dchk/; }
84              
85             sub transport_protocol_default
86             {
87 1     1 0 2 my ($self,$type)=@_;
88              
89 1 50       62 return ('Net::DRI::Transport::Socket',{remote_host => 'epp.sandbox.nic.fr'},'Net::DRI::Protocol::EPP::Extensions::AFNIC',{}) if $type eq 'epp';
90 0 0         return ('Net::DRI::Transport::Socket',{find_remote_server => ['fr.','DCHK1:iris.lwz']},'Net::DRI::Protocol::IRIS',{version=>'1.0',authority=>'fr',request_deflate=>1}) if $type eq 'dchk';
91 0           return;
92             }
93              
94             ####################################################################################################
95              
96             sub domain_operation_needs_is_mine
97             {
98 0     0 0   my ($self,$ndr,$domain,$op)=@_;
99 0 0         return $self->SUPER::domain_operation_needs_is_mine($ndr,$domain,$op) if ($ndr->protocol()->name() eq 'EPP');
100 0           return;
101             }
102              
103             sub domain_create
104             {
105 0     0 0   my ($self,$ndr,$domain,$rd)=@_;
106 0 0         return $self->SUPER::domain_create($ndr,$domain,$rd) unless ($ndr->protocol()->name() eq 'EPP');
107 0 0 0       return $self->SUPER::domain_create($ndr,$domain,$rd) unless (Net::DRI::Util::has_key($rd,'pure_create') && $rd->{pure_create}==1);
108 0           my $ns;
109 0 0 0       if (defined($rd) && (ref($rd) eq 'HASH'))
110             {
111 0           $ns=$rd->{ns};
112 0           delete($rd->{ns});
113             }
114 0           my $rc=$self->SUPER::domain_create($ndr,$domain,$rd); ## create the domain without any nameserver
115 0 0         return $rc unless $rc->is_success();
116 0 0 0       return $rc unless (defined($ns) && Net::DRI::Util::isa_hosts($ns));
117 0           return $self->domain_update_ns_add($ndr,$domain,$ns); ## Finally update domain to add nameservers
118             }
119              
120             sub domain_recover_start
121             {
122 0     0 0   my ($self,$ndr,$domain,$rd)=@_;
123 0           $self->enforce_domain_name_constraints($ndr,$domain,'recover');
124 0           return $ndr->process('domain','recover_request',[$domain,$rd]);
125             }
126              
127             ####################################################################################################
128             1;