File Coverage

blib/lib/Net/DRI/Data/Contact/ARNES.pm
Criterion Covered Total %
statement 9 21 42.8
branch 0 10 0.0
condition 0 8 0.0
subroutine 3 5 60.0
pod 0 2 0.0
total 12 46 26.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 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   1098 use strict;
  1         2  
  1         30  
18 1     1   4 use warnings;
  1         1  
  1         23  
19              
20 1     1   4 use base qw/Net::DRI::Data::Contact/;
  1         2  
  1         261  
21              
22             __PACKAGE__->register_attributes(qw(maticna emso));
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 maticna()
40              
41             stores maticna stevilka (organization id)
42              
43             =head2 emso()
44              
45             stores EMSO (individual id)
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) 2008,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 0           $self->SUPER::validate($change); ## will trigger an Exception if problem
86              
87 0 0 0       push @errs,'maticna' if ($self->maticna() && $self->maticna()!~m/^\d{10}$/);
88 0 0 0       push @errs,'emso' if ($self->emso() && $self->emso()!~m/^\d{13}$/);
89              
90 0 0         Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
91              
92 0           return 1; ## everything ok.
93             }
94              
95             sub init
96             {
97 0     0 0   my ($self,$what,$ndr)=@_;
98              
99 0 0         if ($what eq 'create')
100             {
101 0 0         $self->srid('auto') unless defined($self->srid()); ## we can not choose the ID
102             }
103 0           return;
104             }
105              
106              
107             ####################################################################################################
108             1;