File Coverage

blib/lib/Net/DRI/Data/Contact/SE.pm
Criterion Covered Total %
statement 12 24 50.0
branch 0 8 0.0
condition 0 11 0.0
subroutine 4 6 66.6
pod 0 2 0.0
total 16 51 31.3


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, Handling of contact data for .SE
2             ## Contributed by Elias Sidenbladh and Ulrich Wisser from NIC SE
3             ##
4             ## Copyright (c) 2006-2009,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::Data::Contact::SE;
17              
18 1     1   5 use strict;
  1         2  
  1         41  
19 1     1   7 use warnings;
  1         1  
  1         35  
20 1     1   5 use base qw/Net::DRI::Data::Contact/;
  1         2  
  1         92  
21 1     1   7 use Net::DRI::Exception;
  1         3  
  1         303  
22              
23             __PACKAGE__->register_attributes(qw(orgno vatno));
24              
25             =pod
26              
27             =head1 NAME
28              
29             Net::DRI::Data::Contact::SE - Handle .SE contact data for Net::DRI
30              
31             =head1 DESCRIPTION
32              
33             This subclass of Net::DRI::Data::Contact adds accessors and validation for
34             .SE specific data.
35              
36             =head1 METHODS
37              
38             The following accessors/mutators can be called in chain, as they all return the object itself.
39             The class also have all the accessors/mutators Net::DRI::Data::Contact has.
40              
41             =head2 orgno()
42              
43             Organization registration number for companies or social security number for
44             individuals on the form [] where is the country code and is the
45             organization registration number or the social security number (mandatory)
46              
47             =head1 SUPPORT
48              
49             For now, support questions should be sent to:
50              
51             Enetdri@dotandco.comE
52              
53             Please also see the SUPPORT file in the distribution.
54              
55             =head1 SEE ALSO
56              
57             http://www.dotandco.com/services/software/Net-DRI/
58              
59             =head1 AUTHOR
60              
61             Patrick Mevzek, Enetdri@dotandco.comE
62              
63             =head1 COPYRIGHT
64              
65             Copyright (c) 2006-2009,2013 Patrick Mevzek .
66             All rights reserved.
67              
68             This program is free software; you can redistribute it and/or modify
69             it under the terms of the GNU General Public License as published by
70             the Free Software Foundation; either version 2 of the License, or
71             (at your option) any later version.
72              
73             See the LICENSE file that comes with this distribution for more details.
74              
75             =cut
76              
77             ####################################################################################################
78              
79             sub validate
80             {
81 0     0 0   my ($self,$change)=@_;
82 0   0       $change||=0;
83 0           my @errs;
84              
85             # call parent validate, will trigger an Exception if problem
86 0           $self->SUPER::validate($change); ## will trigger an Exception if problem
87              
88             # validate our extensions
89 0 0 0       push @errs, 'orgno' if ( $self->orgno() && $self->orgno() !~ m/^\[[A-Z]{2}\]/ );
90              
91             # throw exception if errors detected
92 0 0         Net::DRI::Exception::usererr_invalid_parameters( 'Invalid contact information: ' . join( '/', @errs ) ) if @errs;
93              
94             # done, everything ok
95 0           return 1;
96             }
97              
98             sub init
99             {
100 0     0 0   my ($self,$what,$ndr)=@_;
101              
102 0 0         if ($what eq 'create')
103             {
104 0           my $a=$self->auth();
105 0 0 0       $self->auth({pw=>''}) unless ($a && (ref($a) eq 'HASH') && exists($a->{pw}));
      0        
106             }
107 0           return;
108             }
109              
110              
111             ####################################################################################################
112             1;