line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, Handling of contact data for .AT |
2
|
|
|
|
|
|
|
## Contributed by Michael Braunoeder from NIC.AT |
3
|
|
|
|
|
|
|
## |
4
|
|
|
|
|
|
|
## Copyright (c) 2006,2008-2011,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::AT; |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
|
6
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
47
|
|
19
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
49
|
|
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
2
|
|
6
|
use base qw/Net::DRI::Data::Contact/; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
485
|
|
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
2
|
|
9
|
use Net::DRI::Util; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1300
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__PACKAGE__->register_attributes(qw(type)); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=pod |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Net::DRI::Data::Contact::AT - Handle .AT contact data for Net::DRI |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
This subclass of Net::DRI::Data::Contact adds accessors and validation for |
36
|
|
|
|
|
|
|
.AT specific data. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 METHODS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
The following accessors/mutators can be called in chain, as they all return the object itself. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 type() |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
type of contact : privateperson, organisation or role (mandatory) ; the registry may also return unspecified |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 SUPPORT |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
For now, support questions should be sent to: |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Enetdri@dotandco.comE |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Please also see the SUPPORT file in the distribution. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 SEE ALSO |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
http://www.dotandco.com/services/software/Net-DRI/ |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 AUTHOR |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Patrick Mevzek, Enetdri@dotandco.comE |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 COPYRIGHT |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Copyright (c) 2006,2008-2010,2013 Patrick Mevzek . |
65
|
|
|
|
|
|
|
All rights reserved. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
68
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
69
|
|
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or |
70
|
|
|
|
|
|
|
(at your option) any later version. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
See the LICENSE file that comes with this distribution for more details. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#################################################################################################### |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub validate |
79
|
|
|
|
|
|
|
{ |
80
|
0
|
|
|
0
|
0
|
|
my ($self,$change)=@_; |
81
|
0
|
|
0
|
|
|
|
$change||=0; |
82
|
0
|
|
|
|
|
|
my @errs; |
83
|
|
|
|
|
|
|
|
84
|
0
|
0
|
|
|
|
|
if (!$change) |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('Invalid contact information: name/city/cc/email/auth/srid mandatory') unless (scalar(($self->name())[1]) && scalar(($self->city())[1]) && scalar(($self->cc())[1]) && $self->email() && $self->auth() && $self->srid()); |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
0
|
0
|
|
|
|
|
push @errs,'srid' unless Net::DRI::Util::xml_is_token($self->srid(),3,16); |
89
|
|
|
|
|
|
|
|
90
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('Invalid contact information: type mandatory') unless ($self->type()); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
0
|
0
|
0
|
|
|
|
push @errs,'srid' if ($self->srid() && $self->srid()!~m/^\w{1,80}-\w{1,8}$/ && $self->srid()!~m/^AUTO$/i); ## \w includes _ in Perl |
|
|
|
0
|
|
|
|
|
94
|
0
|
0
|
0
|
|
|
|
push @errs,'name' if ($self->name() && !Net::DRI::Util::xml_is_normalizedstring(($self->name())[1],1,255)); |
95
|
0
|
0
|
0
|
|
|
|
push @errs,'org' if ($self->org() && !Net::DRI::Util::xml_is_normalizedstring(($self->org())[1],undef,255)); |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
my @rs=($self->street()); |
98
|
0
|
0
|
|
|
|
|
if ($rs[1]) |
99
|
|
|
|
|
|
|
{ |
100
|
0
|
0
|
0
|
|
|
|
push @errs,'street' if ((ref($rs[1]) ne 'ARRAY') || (@{$rs[1]} > 3) || (grep { !Net::DRI::Util::xml_is_normalizedstring($_,undef,255) } @{$rs[1]})); |
|
0
|
|
0
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
0
|
0
|
0
|
|
|
|
push @errs,'city' if ($self->city() && !Net::DRI::Util::xml_is_normalizedstring(($self->city())[1],1,255)); |
104
|
0
|
0
|
0
|
|
|
|
push @errs,'sp' if ($self->sp() && !Net::DRI::Util::xml_is_normalizedstring(($self->sp())[1],undef,255)); |
105
|
0
|
0
|
0
|
|
|
|
push @errs,'pc' if ($self->pc() && !Net::DRI::Util::xml_is_token(($self->pc())[1],1,16)); |
106
|
0
|
0
|
0
|
|
|
|
push @errs,'cc' if ($self->cc() && !Net::DRI::Util::xml_is_token(($self->cc())[1],2,2)); |
107
|
0
|
0
|
0
|
|
|
|
push @errs,'cc' if ($self->cc() && grep { !exists($Net::DRI::Util::CCA2{uc($_)}) } ($self->cc())); |
|
0
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
0
|
0
|
0
|
|
|
|
push @errs,'voice' if ($self->voice() && (!Net::DRI::Util::xml_is_token($self->voice(),undef,17) || $self->voice()!~m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/)); |
|
|
|
0
|
|
|
|
|
110
|
0
|
0
|
0
|
|
|
|
push @errs,'fax' if ($self->fax() && (!Net::DRI::Util::xml_is_token($self->fax(),undef,17) || $self->fax()!~m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/)); |
|
|
|
0
|
|
|
|
|
111
|
0
|
0
|
0
|
|
|
|
push @errs,'email' if ($self->email() && (!Net::DRI::Util::xml_is_token($self->email(),1,undef) || !Email::Valid->rfc822($self->email()))); |
|
|
|
0
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
my $ra=$self->auth(); |
114
|
0
|
0
|
0
|
|
|
|
push @errs,'auth' if ($ra && (ref($ra) eq 'HASH') && exists($ra->{pw}) && !Net::DRI::Util::xml_is_normalizedstring($ra->{pw})); |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
0
|
0
|
0
|
|
|
|
push @errs,'type' if ($self->type() && $self->type()!~m/^(?:privateperson|organisation|role)$/); |
118
|
|
|
|
|
|
|
|
119
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs; |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
return 1; ## everything ok. |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub init |
125
|
|
|
|
|
|
|
{ |
126
|
0
|
|
|
0
|
0
|
|
my ($self,$what,$ndr)=@_; |
127
|
|
|
|
|
|
|
|
128
|
0
|
0
|
|
|
|
|
if ($what eq 'create') |
129
|
|
|
|
|
|
|
{ |
130
|
0
|
|
|
|
|
|
my $a=$self->auth(); |
131
|
0
|
0
|
0
|
|
|
|
$self->auth({pw=>''}) unless ($a && (ref($a) eq 'HASH') && exists($a->{pw})); ## Mandatory in EPP, not used by .AT |
|
|
|
0
|
|
|
|
|
132
|
0
|
0
|
|
|
|
|
$self->srid('auto') unless defined($self->srid()); ## we can not choose the ID |
133
|
|
|
|
|
|
|
} |
134
|
0
|
|
|
|
|
|
return; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
#################################################################################################### |
138
|
|
|
|
|
|
|
1; |