File Coverage

blib/lib/Net/DRI/Data/Contact/ARNES.pm
Criterion Covered Total %
statement 9 22 40.9
branch 0 10 0.0
condition 0 11 0.0
subroutine 3 5 60.0
pod 0 2 0.0
total 12 50 24.0


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, Handling of contact data for .SI
2             ##
3             ## Copyright (c) 2008,2009,2013,2016 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::ARNES;
16              
17 1     1   864 use strict;
  1         1  
  1         21  
18 1     1   3 use warnings;
  1         1  
  1         19  
19              
20 1     1   3 use base qw/Net::DRI::Data::Contact/;
  1         1  
  1         231  
21              
22             __PACKAGE__->register_attributes(qw(ctype));
23              
24             =pod
25              
26             =head1 NAME
27              
28             Net::DRI::Data::Contact::ARNES - Handle .SI contact data for Net::DRI
29              
30             =head1 DESCRIPTION
31              
32             This subclass of Net::DRI::Data::Contact adds accessors and validation for
33             .SI specific data.
34              
35             =head1 METHODS
36              
37             The following accessors/mutators can be called in chain, as they all return the object itself.
38              
39             =head2 ctype()
40              
41             stores type of the contact object which can be 'person' for private persons or 'org' for organizations
42              
43             =head1 SUPPORT
44              
45             For now, support questions should be sent to:
46              
47             Enetdri@dotandco.comE
48              
49             Please also see the SUPPORT file in the distribution.
50              
51             =head1 SEE ALSO
52              
53             http://www.dotandco.com/services/software/Net-DRI/
54              
55             =head1 AUTHOR
56              
57             Patrick Mevzek, Enetdri@dotandco.comE
58              
59             =head1 COPYRIGHT
60              
61             Copyright (c) 2008,2009,2013,2016 Patrick Mevzek .
62             All rights reserved.
63              
64             This program is free software; you can redistribute it and/or modify
65             it under the terms of the GNU General Public License as published by
66             the Free Software Foundation; either version 2 of the License, or
67             (at your option) any later version.
68              
69             See the LICENSE file that comes with this distribution for more details.
70              
71             =cut
72              
73             ####################################################################################################
74              
75             sub validate
76             {
77 0     0 0   my ($self,$change)=@_;
78 0   0       $change||=0;
79 0           my @errs;
80              
81 0           $self->SUPER::validate($change); ## will trigger an Exception if problem
82              
83 0 0 0       push @errs,'ctype' if ($self->ctype() && $self->ctype()!~m/^(person|org)$/);
84              
85 0 0         Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
86              
87 0           return 1; ## everything ok.
88             }
89              
90             sub init
91             {
92 0     0 0   my ($self,$what,$ndr)=@_;
93              
94 0 0         if ($what eq 'create')
95             {
96 0 0         $self->srid('auto') unless defined($self->srid()); ## we can not choose the ID
97 0           my $a=$self->auth();
98 0 0 0       $self->auth({pw=>''}) unless ($a && (ref($a) eq 'HASH') && exists($a->{pw}));
      0        
99             }
100 0           return;
101             }
102              
103             ####################################################################################################
104             1;