line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, Handling of contact data for .CO.ZA |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2011 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::COZA; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
788
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
4
|
use base qw(Net::DRI::Data::Contact); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
69
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
5
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
14
|
|
23
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
266
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#################################################################################################### |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub validate ## See http://registry.coza.net.za/doku.php?id=eppcontactconstraints |
28
|
|
|
|
|
|
|
{ |
29
|
0
|
|
|
0
|
0
|
|
my ($self,$change)=@_; |
30
|
0
|
|
0
|
|
|
|
$change||=0; |
31
|
0
|
|
|
|
|
|
my @errs; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$self->SUPER::validate($change); ## will trigger an Exception if problem |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my @rs=($self->street()); |
36
|
0
|
|
|
|
|
|
foreach my $i (0,1) |
37
|
|
|
|
|
|
|
{ |
38
|
0
|
0
|
|
|
|
|
next unless defined $rs[$i]; |
39
|
0
|
0
|
0
|
|
|
|
push @errs,'street' if ((ref($rs[$i]) ne 'ARRAY') || (@{$rs[$i]} > 3) || (grep { !Net::DRI::Util::xml_is_normalizedstring($_,8,255) } @{$rs[$i]})); |
|
0
|
|
0
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
0
|
|
|
|
push @errs,'city' if ($self->city() && grep { !Net::DRI::Util::xml_is_normalizedstring($_,2,255) } ($self->city())); |
|
0
|
|
|
|
|
|
|
43
|
0
|
0
|
0
|
|
|
|
push @errs,'sp' if ($self->sp() && grep { !Net::DRI::Util::xml_is_normalizedstring($_,2,255) } ($self->sp())); |
|
0
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my $ra=$self->auth(); |
46
|
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
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
## disclose not supported at all |
49
|
0
|
0
|
|
|
|
|
push @errs,'disclose' if defined $self->disclose(); |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs; |
52
|
0
|
|
|
|
|
|
return 1; ## everything ok. |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
#################################################################################################### |
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |