File Coverage

blib/lib/Net/DRI/Data/Contact/SIDN.pm
Criterion Covered Total %
statement 12 32 37.5
branch 0 20 0.0
condition 0 23 0.0
subroutine 4 6 66.6
pod 0 2 0.0
total 16 83 19.2


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, Handling of contact data for SIDN
2             ##
3             ## Copyright (c) 2009,2010,2013 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::Data::Contact::SIDN;
16              
17 1     1   670 use strict;
  1         1  
  1         23  
18 1     1   3 use warnings;
  1         1  
  1         20  
19              
20 1     1   4 use base qw/Net::DRI::Data::Contact/;
  1         1  
  1         54  
21              
22 1     1   4 use Net::DRI::Exception;
  1         2  
  1         309  
23              
24             __PACKAGE__->register_attributes(qw(legal_form legal_id limited));
25              
26             ####################################################################################################
27              
28             sub validate
29             {
30 0     0 0   my ($self,$change)=@_;
31 0   0       $change||=0;
32              
33 0           $self->SUPER::validate(1); ## will trigger an Exception if problem
34              
35 0 0         if (!$change)
36             {
37 0 0 0       my @missing=grep { my $r=scalar $self->$_(); (defined $r && length $r)? 0 : 1 } qw/legal_form/;
  0            
  0            
38 0 0         Net::DRI::Exception::usererr_insufficient_parameters('Mandatory contact information missing: '.join('/',@missing)) if @missing;
39             }
40              
41 0           my @errs;
42 0 0 0       push @errs,'legal_form' if (defined $self->legal_form() && $self->legal_form()!~m!^(?:ANDERS|BGG|BRO|BV|BVI/O|COOP|CV|EENMANSZAAK|EESV|KERK|MAATSCHAP|NV|OWM|PERSOON|REDR|STICHTING|VERENIGING|VOF)$!o);
43              
44             ## Changes from core EPP
45 0 0 0       push @errs,'pc' if (defined $self->cc() && $self->cc() eq 'NL' && ! $self->pc());
      0        
46 0 0 0       push @errs,'voice' if (!$change && ! $self->voice());
47              
48 0 0         Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
49 0           return 1; ## everything ok.
50             }
51              
52             sub init
53             {
54 0     0 0   my ($self,$what,$ndr)=@_;
55 0 0         if ($what eq 'create')
56             {
57 0           my $a=$self->auth();
58 0 0 0       $self->auth({pw=>''}) unless ($a && (ref($a) eq 'HASH') && exists($a->{pw})); ## authInfo is not used
      0        
59 0 0         $self->srid('ABCD') unless defined $self->srid(); ## we can not choose the ID
60             }
61 0           return;
62             }
63              
64             ####################################################################################################
65             1;
66              
67             __END__