DRI/Data/Contact/NO.pm

filter: Statementstmt 23.9% 23 / 96 Branchbran 0.0% 0 / 82 Conditioncond 0.0% 0 / 113 MC/DCmcdc 0.0% 0 / 59 Subroutinesub 77.7% 7 / 9 Podpod 0.0% 0 / 2 totaltotal 8.3% 30 / 361 CC 84 SCAR 86.0
CC
84
Cov
8%
validate
6320.0
init
42.0
BEGIN
1.0
CRAP 5429.8
↑ Summary DRI/Data/Contact/AFNIC.pm »
1 ## Domain Registry Interface, Handling of contact data for .NO
2 ##
3 ## Copyright (c) 2008-2011,2014 UNINETT Norid AS, E<lt>http://www.norid.noE<gt>,
4 ## Trond Haugen E<lt>info@norid.noE<gt>.
5 ## All rights reserved.
6 ##
7 ## This file is part of Net::DRI
8 ##
9 ## Net::DRI is free software; you can redistribute it and/or modify
10 ## it under the terms of the GNU General Public License as published by
11 ## the Free Software Foundation; either version 2 of the License, or
12 ## (at your option) any later version.
13 ##
14 ## See the LICENSE file that comes with this distribution for more details.
15 ###############################################################################
16  
17 package Net::DRI::Data::Contact::NO;
18  
19 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use base qw/Net::DRI::Data::Contact/;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use Email::Valid;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 1 __PACKAGE__->register_attributes(qw(type identity mobilephone organization rolecontact xemail xdisclose facets));
28  
29 =pod
30  
31 =encoding utf8
32  
33 =head1 NAME
34  
35 Net::DRI::Data::Contact::NO - Handle .NO contact data for Net::DRI
36  
37 =head1 DESCRIPTION
38  
39 This subclass of Net::DRI::Data::Contact adds accessors and validation for
40 .NO specific data.
41  
42 =head1 METHODS
43  
44 The following accessors/mutators can be called in chain, as they all return
45 the object itself.
46  
47 =head2 type()
48  
49 Mandatory, must be set for all contacts. Specify what type of contact to
50 register. Value must be one of: 'person', 'organization' or 'role'.
51  
52 Example: $co->type('organization')
53  
54 =head2 identity()
55  
56 Currently valid for type='organization' only.
57 Must then be set to specify the organization number in Brønnøysund,
58 the Norwegian Business Register.
59  
60 Example: $co->identity({type=>'organizationNumber', value=>'987654321'});
61  
62 =head2 mobilephone()
63  
64 Optional. Set a mobile phone number for the contact.
65  
66 Example: $co->mobilephone('+47.123456780')
67  
68 =head2 organization()
69  
70 Optional. Set one or more organization-elements which specify organizations
71 which the contact belongs to. The value should be the local contact id
72 of an organization object.
73  
74 This element can only be used for role and person contacts.
75  
76 $co->organization('EFA12O');
77  
78 =head2 rolecontact()
79  
80 Optional. Set one or more roleContact-elements which specify persons which
81 belongs to a role contact. The value should be the local contact id of a
82 person object.
83  
84 This element can only be used for role contacts.
85  
86 Example: $co->rolecontact(['JD12P', 'JD13P']);
87  
88 =head2 xemail()
89  
90 Optional. Set one or more email-elements which specify email addresses in
91 addition to the mandatory email element in the standard contact create command.
92  
93 Example: $co->xemail(['xtra1@example.no', 'xtra2@example.no']);
94  
95 =head2 xdisclose()
96  
97 Optional. A disclose-element which must contain the child element mobilePhone.
98 This element notes the clients preference to allow or restrict disclosure of
99 the mobile phone number. If not present, the servers stated data collection
100 policy is used.
101  
102 Example: $co->xdisclose({mobilePhone=>0});
103  
104 =head2 facets()
105 Facets are some special control attributes that can be used to
106 implement a super registrar (admin registrar).
107  
108 A super registrar can suppress certain checks and perform actions on behalf of a normal registrar.
109  
110 Facets are key/values pairs.
111 Net::DRI will not try to enforce what key/value pairs that are possible,
112 but let the registry decide their validity.
113  
114 Example: $co->facets( { 'skip-manual-review' => 1, 'ignores-exceptions' => 'reg123'} );
115  
116  
117 =head1 SUPPORT
118  
119 For now, support questions should be sent to:
120  
121 E<lt>netdri@dotandco.comE<gt>
122  
123 Please also see the SUPPORT file in the distribution.
124  
125 =head1 SEE ALSO
126  
127 http://www.dotandco.com/services/software/Net-DRI/
128  
129 =head1 AUTHOR
130  
131 Trond Haugen, E<lt>info@norid.noE<gt>.
132  
133 =head1 COPYRIGHT
134  
135 Copyright (c) 2008-2010,2014 UNINETT Norid AS, E<lt>http://www.norid.noE<gt>,
136 Trond Haugen E<lt>info@norid.noE<gt>.
137 All rights reserved.
138  
139 This program is free software; you can redistribute it and/or modify
140 it under the terms of the GNU General Public License as published by
141 the Free Software Foundation; either version 2 of the License, or
142 (at your option) any later version.
143  
144 See the LICENSE file that comes with this distribution for more details.
145  
146 =cut
147  
148 ####################################################################################################
149  
150 sub validate {
151 0 ▶ my ( $self, $change ) = @_;
Subroutine validate: not called CC=79 SCAR=87.5
Pod undocumented
152 0 ▶ $change ||= 0;
Condition0%0/2
$change ||= 0
l!l
00
MC/DC0%0/1
$change ||= 0
$change
Truth table0%0/2
A
A= $change
Aresult
11
00
153  
154 0 my @errs;
155  
156 0 ▶ if ( !$change ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($change) 0 0 0
157 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters(
Branch: 1 branch
BranchTrueFalseTotal
unless $self->name and $self->city and $self->cc and $self->email and $self->auth and $self->srid 0 0 0
Condition0%0/15
$self->name and $self->city and $self->cc and $self->email and $self->auth and $self->srid
!ll&&!rl&&r
000
$self->name and $self->city and $self->cc and $self->email and $self->auth
!ll&&!rl&&r
000
$self->name and $self->city and $self->cc and $self->email
!ll&&!rl&&r
000
$self->name and $self->city and $self->cc
!ll&&!rl&&r
000
$self->name and $self->city
!ll&&!rl&&r
000
MC/DC0%0/6
$self->name and $self->city and $self->cc and $self->email and $self->auth and $self->srid
$self->name $self->city $self->cc $self->email $self->auth $self->srid
Truth table0%0/7
A and B and C and D and E and F
A= $self->nameB= $self->cityC= $self->ccD= $self->emailE= $self->authF= $self->srid
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
158 'Invalid contact information: name/city/cc/email/auth/srid mandatory'
159 )
160 unless $self->name()
161 && $self->city()
162 && $self->cc()
163 && $self->email()
164 && $self->auth()
165 && $self->srid();
166 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters(
Branch: 1 branch
BranchTrueFalseTotal
if $self->org 0 0 0
167 'Invalid contact information: org is not allowed for .NO')
168 if ( $self->org() );
169 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters(
Branch: 1 branch
BranchTrueFalseTotal
unless $self->type 0 0 0
170 'Invalid contact information: type mandatory')
171 unless ( $self->type() );
172 }
173  
174 0 ▶ push @errs,'srid' if ($self->srid() && ! Net::DRI::Util::xml_is_token($self->srid(),3,16));
Branch: 1 branch
BranchTrueFalseTotal
if $self->srid and not Net::DRI::Util::xml_is_token($self->srid, 3, 16) 0 0 0
Condition0%0/3
$self->srid and not Net::DRI::Util::xml_is_token($self->srid, 3, 16)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->srid and not Net::DRI::Util::xml_is_token($self->srid, 3, 16)
$self->srid not Net::DRI::Util::xml_is_token($self->srid, 3, 16)
Truth table0%0/3
A and not(B)
A= $self->sridB= not Net::DRI::Util::xml_is_token($self->srid, 3, 16)
ABresult
0X0
100
111
175 push @errs, 'name'
176 if ( $self->name()
177 0 ▶ && grep { !Net::DRI::Util::xml_is_normalizedstring( $_, 1, 255 ) }
Branch: 1 branch
BranchTrueFalseTotal
if $self->name and grep {not Net::DRI::Util::xml_is_normalizedstring($_, 1, 255);} $self->name 0 0 0
Condition0%0/3
$self->name and grep {not Net::DRI::Util::xml_is_normalizedstring($_, 1, 255);} $self->name
!ll&&!rl&&r
000
MC/DC0%0/2
$self->name and grep {not Net::DRI::Util::xml_is_normalizedstring($_, 1, 255);} $self->name
$self->name grep {not Net::DRI::Util::xml_is_normalizedstring($_, 1, 255);} $self->name
Truth table0%0/3
A and B
A= $self->nameB= grep {not Net::DRI::Util::xml_is_normalizedstring($_, 1, 255);} $self->name
ABresult
0X0
100
111
178 ( $self->name() ) );
179 push @errs, 'org'
180 if ( $self->org()
181 0 ▶ && grep { !Net::DRI::Util::xml_is_normalizedstring( $_, undef, 255 ) }
Branch: 1 branch
BranchTrueFalseTotal
if $self->org and grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} $self->org 0 0 0
Condition0%0/3
$self->org and grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} $self->org
!ll&&!rl&&r
000
MC/DC0%0/2
$self->org and grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} $self->org
$self->org grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} $self->org
Truth table0%0/3
A and B
A= $self->orgB= grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} $self->org
ABresult
0X0
100
111
182 ( $self->org() ) );
183  
184 0 my @rs = ( $self->street() );
185  
186 0 foreach my $i ( 0, 1 ) {
187 0 ▶ next unless $rs[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless $rs[$i] 0 0 0
188 push @errs, 'street'
189 if (
190 0 ( ref( $rs[$i] ) ne 'ARRAY' ) || ( @{ $rs[$i] } > 3 ) || (
191 grep {
192 0 !Net::DRI::Util::xml_is_normalizedstring( $_, undef, 255 )
193 0 ▶ } @{ $rs[$i] }
Branch: 1 branch
BranchTrueFalseTotal
if ref $rs[$i] ne "ARRAY" or @{$rs[$i];} > 3 or grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} @{$rs[$i];} 0 0 0
Condition0%0/6
ref $rs[$i] ne "ARRAY" or @{$rs[$i];} > 3 or grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} @{$rs[$i];}
l!l&&r!l&&!r
000
ref $rs[$i] ne "ARRAY" or @{$rs[$i];} > 3
l!l&&r!l&&!r
000
MC/DC0%0/3
ref $rs[$i] ne "ARRAY" or @{$rs[$i];} > 3 or grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} @{$rs[$i];}
ref $rs[$i] ne "ARRAY" @{$rs[$i];} > 3 grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} @{$rs[$i];}
Truth table0%0/4
A or B or C
A= ref $rs[$i] ne "ARRAY"B= @{$rs[$i];} > 3C= grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} @{$rs[$i];}
ABCresult
1XX1
01X1
0011
0000
194 )
195 );
196 }
197  
198 push @errs, 'city'
199 if ( $self->city()
200 0 ▶ && grep { !Net::DRI::Util::xml_is_normalizedstring( $_, 1, 255 ) }
Branch: 1 branch
BranchTrueFalseTotal
if $self->city and grep {not Net::DRI::Util::xml_is_normalizedstring($_, 1, 255);} $self->city 0 0 0
Condition0%0/3
$self->city and grep {not Net::DRI::Util::xml_is_normalizedstring($_, 1, 255);} $self->city
!ll&&!rl&&r
000
MC/DC0%0/2
$self->city and grep {not Net::DRI::Util::xml_is_normalizedstring($_, 1, 255);} $self->city
$self->city grep {not Net::DRI::Util::xml_is_normalizedstring($_, 1, 255);} $self->city
Truth table0%0/3
A and B
A= $self->cityB= grep {not Net::DRI::Util::xml_is_normalizedstring($_, 1, 255);} $self->city
ABresult
0X0
100
111
201 ( $self->city() ) );
202 push @errs, 'sp'
203 if ( $self->sp()
204 0 ▶ && grep { !Net::DRI::Util::xml_is_normalizedstring( $_, undef, 255 ) }
Branch: 1 branch
BranchTrueFalseTotal
if $self->sp and grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} $self->sp 0 0 0
Condition0%0/3
$self->sp and grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} $self->sp
!ll&&!rl&&r
000
MC/DC0%0/2
$self->sp and grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} $self->sp
$self->sp grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} $self->sp
Truth table0%0/3
A and B
A= $self->spB= grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} $self->sp
ABresult
0X0
100
111
205 ( $self->sp() ) );
206 push @errs, 'pc'
207 if ( $self->pc()
208 0 ▶ && grep { !Net::DRI::Util::xml_is_token( $_, undef, 16 ) }
Branch: 1 branch
BranchTrueFalseTotal
if $self->pc and grep {not Net::DRI::Util::xml_is_token($_, undef, 16);} $self->pc 0 0 0
Condition0%0/3
$self->pc and grep {not Net::DRI::Util::xml_is_token($_, undef, 16);} $self->pc
!ll&&!rl&&r
000
MC/DC0%0/2
$self->pc and grep {not Net::DRI::Util::xml_is_token($_, undef, 16);} $self->pc
$self->pc grep {not Net::DRI::Util::xml_is_token($_, undef, 16);} $self->pc
Truth table0%0/3
A and B
A= $self->pcB= grep {not Net::DRI::Util::xml_is_token($_, undef, 16);} $self->pc
ABresult
0X0
100
111
209 ( $self->pc() ) );
210 push @errs, 'cc'
211 0 ▶ if ( $self->cc() && grep { !Net::DRI::Util::xml_is_token( $_, 2, 2 ) }
Branch: 1 branch
BranchTrueFalseTotal
if $self->cc and grep {not Net::DRI::Util::xml_is_token($_, 2, 2);} $self->cc 0 0 0
Condition0%0/3
$self->cc and grep {not Net::DRI::Util::xml_is_token($_, 2, 2);} $self->cc
!ll&&!rl&&r
000
MC/DC0%0/2
$self->cc and grep {not Net::DRI::Util::xml_is_token($_, 2, 2);} $self->cc
$self->cc grep {not Net::DRI::Util::xml_is_token($_, 2, 2);} $self->cc
Truth table0%0/3
A and B
A= $self->ccB= grep {not Net::DRI::Util::xml_is_token($_, 2, 2);} $self->cc
ABresult
0X0
100
111
212 ( $self->cc() ) );
213 push @errs, 'cc'
214 if ( $self->cc()
215 0 ▶ && grep { !exists( $Net::DRI::Util::CCA2{ uc($_) } ) }
Branch: 1 branch
BranchTrueFalseTotal
if $self->cc and grep {not exists $Net::DRI::Util::CCA2{uc $_};} $self->cc 0 0 0
Condition0%0/3
$self->cc and grep {not exists $Net::DRI::Util::CCA2{uc $_};} $self->cc
!ll&&!rl&&r
000
MC/DC0%0/2
$self->cc and grep {not exists $Net::DRI::Util::CCA2{uc $_};} $self->cc
$self->cc grep {not exists $Net::DRI::Util::CCA2{uc $_};} $self->cc
Truth table0%0/3
A and B
A= $self->ccB= grep {not exists $Net::DRI::Util::CCA2{uc $_};} $self->cc
ABresult
0X0
100
111
216 ( $self->cc() ) );
217  
218 0 ▶ push @errs, 'voice'
Branch: 1 branch
BranchTrueFalseTotal
if $self->voice and not Net::DRI::Util::xml_is_token($self->voice, undef, 17) and not $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx 0 0 0
Condition0%0/6
$self->voice and not Net::DRI::Util::xml_is_token($self->voice, undef, 17) and not $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx
!ll&&!rl&&r
000
$self->voice and not Net::DRI::Util::xml_is_token($self->voice, undef, 17)
!ll&&!rl&&r
000
MC/DC0%0/3
$self->voice and not Net::DRI::Util::xml_is_token($self->voice, undef, 17) and not $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx
$self->voice not Net::DRI::Util::xml_is_token($self->voice, undef, 17) not $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx
Truth table0%0/4
A and not(B) and not(C)
A= $self->voiceB= not Net::DRI::Util::xml_is_token($self->voice, undef, 17)C= not $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx
ABCresult
0XX0
10X0
1100
1111
219 if ( $self->voice()
220 && !Net::DRI::Util::xml_is_token( $self->voice(), undef, 17 )
221 && $self->voice() !~ m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx );
222 0 ▶ push @errs, 'fax'
Branch: 1 branch
BranchTrueFalseTotal
if $self->fax and not Net::DRI::Util::xml_is_token($self->fax, undef, 17) and not $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx 0 0 0
Condition0%0/6
$self->fax and not Net::DRI::Util::xml_is_token($self->fax, undef, 17) and not $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx
!ll&&!rl&&r
000
$self->fax and not Net::DRI::Util::xml_is_token($self->fax, undef, 17)
!ll&&!rl&&r
000
MC/DC0%0/3
$self->fax and not Net::DRI::Util::xml_is_token($self->fax, undef, 17) and not $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx
$self->fax not Net::DRI::Util::xml_is_token($self->fax, undef, 17) not $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx
Truth table0%0/4
A and not(B) and not(C)
A= $self->faxB= not Net::DRI::Util::xml_is_token($self->fax, undef, 17)C= not $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx
ABCresult
0XX0
10X0
1100
1111
223 if ( $self->fax()
224 && !Net::DRI::Util::xml_is_token( $self->fax(), undef, 17 )
225 && $self->fax() !~ m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx );
226 0 ▶ push @errs, 'email'
Branch: 1 branch
BranchTrueFalseTotal
if $self->email and not Net::DRI::Util::xml_is_token($self->email, 1, undef) && "Email::Valid"->rfc822($self->email) 0 0 0
Condition0%0/6
$self->email and not Net::DRI::Util::xml_is_token($self->email, 1, undef) && "Email::Valid"->rfc822($self->email)
!ll&&!rl&&r
000
Net::DRI::Util::xml_is_token($self->email, 1, undef) && 'Email::Valid'->rfc822($self->email)
!ll&&!rl&&r
000
MC/DC0%0/3
$self->email and not Net::DRI::Util::xml_is_token($self->email, 1, undef) && "Email::Valid"->rfc822($self->email)
$self->email Net::DRI::Util::xml_is_token($self->email, 1, undef) 'Email::Valid'->rfc822($self->email)
Truth table0%0/4
A and not(B && C)
A= $self->emailB= Net::DRI::Util::xml_is_token($self->email, 1, undef)C= 'Email::Valid'->rfc822($self->email)
ABCresult
0XX0
1110
10X1
1101
227 if (
228 $self->email()
229 && !(
230 Net::DRI::Util::xml_is_token( $self->email(), 1, undef )
231 && Email::Valid->rfc822( $self->email() )
232 )
233 );
234  
235 0 my $ra = $self->auth();
236 push @errs, 'auth'
237 if ( $ra
238 && ( ref($ra) eq 'HASH' )
239 && exists( $ra->{pw} )
240 0 ▶ && !Net::DRI::Util::xml_is_normalizedstring( $ra->{pw} ) );
Branch: 1 branch
BranchTrueFalseTotal
if $ra and ref $ra eq "HASH" and exists $ra->{"pw"} and not Net::DRI::Util::xml_is_normalizedstring($ra->{"pw"}) 0 0 0
Condition0%0/9
$ra and ref $ra eq "HASH" and exists $ra->{"pw"} and not Net::DRI::Util::xml_is_normalizedstring($ra->{"pw"})
!ll&&!rl&&r
000
$ra and ref $ra eq "HASH" and exists $ra->{"pw"}
!ll&&!rl&&r
000
$ra and ref $ra eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/4
$ra and ref $ra eq "HASH" and exists $ra->{"pw"} and not Net::DRI::Util::xml_is_normalizedstring($ra->{"pw"})
$ra ref $ra eq "HASH" exists $ra->{"pw"} not Net::DRI::Util::xml_is_normalizedstring($ra->{"pw"})
Truth table0%0/5
A and B and C and not(D)
A= $raB= ref $ra eq "HASH"C= exists $ra->{"pw"}D= not Net::DRI::Util::xml_is_normalizedstring($ra->{"pw"})
ABCDresult
0XXX0
10XX0
110X0
11100
11111
241  
242 # .NO
243 0 my $t = $self->type();
244 0 ▶ push @errs, 'type' if ( $t && $t !~ m/^(?:person|organization|role)$/mx );
Branch: 1 branch
BranchTrueFalseTotal
if $t and not $t =~ /^(?:person|organization|role)$/mx 0 0 0
Condition0%0/3
$t and not $t =~ /^(?:person|organization|role)$/mx
!ll&&!rl&&r
000
MC/DC0%0/2
$t and not $t =~ /^(?:person|organization|role)$/mx
$t not $t =~ /^(?:person|organization|role)$/mx
Truth table0%0/3
A and not(B)
A= $tB= not $t =~ /^(?:person|organization|role)$/mx
ABresult
0X0
100
111
245  
246 0 $t = $self->identity();
247  
248 0 ▶ if ($t) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t) 0 0 0
249 0 my $ty = $t->{type};
250 0 my $va = $t->{value};
251 0 ▶ push @errs, 'identity type'
Branch: 1 branch
BranchTrueFalseTotal
if $ty and not $ty =~ /^(?:organizationNumber|localIdentity|nationalIdentityNumber|anonymousPersonIdentifier)$/mx 0 0 0
Condition0%0/3
$ty and not $ty =~ /^(?:organizationNumber|localIdentity|nationalIdentityNumber|anonymousPersonIdentifier)$/mx
!ll&&!rl&&r
000
MC/DC0%0/2
$ty and not $ty =~ /^(?:organizationNumber|localIdentity|nationalIdentityNumber|anonymousPersonIdentifier)$/mx
$ty not $ty =~ /^(?:organizationNumber|localIdentity|nationalIdentityNumber|anonymousPersonIdentifier)$/mx
Truth table0%0/3
A and not(B)
A= $tyB= not $ty =~ /^(?:organizationNumber|localIdentity|nationalIdentityNumber|anonymousPersonIdentifier)$/mx
ABresult
0X0
100
111
252 if ( $ty
253 && $ty
254 !~ m/^(?:organizationNumber|localIdentity|nationalIdentityNumber|anonymousPersonIdentifier)$/mx
255 );
256  
257 # let the server handle further validation of what identity syntax
258 # and values are legal
259 }
260 0 $t = $self->mobilephone();
261 0 ▶ push @errs, 'mobilephone'
Branch: 1 branch
BranchTrueFalseTotal
if $t and not Net::DRI::Util::xml_is_token($t, undef, 17) and not $t =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx 0 0 0
Condition0%0/6
$t and not Net::DRI::Util::xml_is_token($t, undef, 17) and not $t =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx
!ll&&!rl&&r
000
$t and not Net::DRI::Util::xml_is_token($t, undef, 17)
!ll&&!rl&&r
000
MC/DC0%0/3
$t and not Net::DRI::Util::xml_is_token($t, undef, 17) and not $t =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx
$t not Net::DRI::Util::xml_is_token($t, undef, 17) not $t =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx
Truth table0%0/4
A and not(B) and not(C)
A= $tB= not Net::DRI::Util::xml_is_token($t, undef, 17)C= not $t =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx
ABCresult
0XX0
10X0
1100
1111
262 if ( $t
263 && !Net::DRI::Util::xml_is_token( $t, undef, 17 )
264 && $t !~ m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx );
265  
266 #
267 0 foreach my $el ( 'organization', 'rolecontact', 'xemail' ) {
268 0 ▶ if ( $t = $self->$el() ) { # option, as scalar or array
Branch: 1 branch
BranchTrueFalseTotal
if ($t = $self->$el) 0 0 0
269 0 my @em;
270 my $er;
271  
272 0 ▶ if ($change) {
Branch: 1 branch
BranchTrueFalseTotal
if ($change) { } 0 0 0
273 0 ▶ if ( ref($t) eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $t eq 'HASH') { } 0 0 0
274 0 foreach my $s ( 'add', 'del' ) {
275 0 my $e = $t->{$s};
276 0 ▶ if ( ref($e) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $e eq 'ARRAY') { } 0 0 0
277 0 ▶ push @em, @$e if (@$e);
Branch: 1 branch
BranchTrueFalseTotal
if @$e 0 0 0
278 } else {
279 0 ▶ push @em, $e if ($e);
Branch: 1 branch
BranchTrueFalseTotal
if $e 0 0 0
280 }
281 }
282 } else {
283 0 $er .= ":update needs an add/del hash:";
284 }
285 } else {
286 0 ▶ if ( ref($t) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $t eq 'ARRAY') { } 0 0 0
287 0 ▶ push @em, @$t if (@$t);
Branch: 1 branch
BranchTrueFalseTotal
if @$t 0 0 0
288 } else {
289 0 ▶ push @em, $t if ($t);
Branch: 1 branch
BranchTrueFalseTotal
if $t 0 0 0
290 }
291 }
292 0 foreach my $e (@em) {
293 0 ▶ if ( $el eq 'xemail' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($el eq 'xemail') { } 0 0 0
294 0 ▶ $er .= " $e "
Branch: 1 branch
BranchTrueFalseTotal
if $e and not Net::DRI::Util::xml_is_token($e, 1, undef) && "Email::Valid"->rfc822($e) 0 0 0
Condition0%0/6
$e and not Net::DRI::Util::xml_is_token($e, 1, undef) && "Email::Valid"->rfc822($e)
!ll&&!rl&&r
000
Net::DRI::Util::xml_is_token($e, 1, undef) && 'Email::Valid'->rfc822($e)
!ll&&!rl&&r
000
MC/DC0%0/3
$e and not Net::DRI::Util::xml_is_token($e, 1, undef) && "Email::Valid"->rfc822($e)
$e Net::DRI::Util::xml_is_token($e, 1, undef) 'Email::Valid'->rfc822($e)
Truth table0%0/4
A and not(B && C)
A= $eB= Net::DRI::Util::xml_is_token($e, 1, undef)C= 'Email::Valid'->rfc822($e)
ABCresult
0XX0
1110
10X1
1101
295 if (
296 $e
297 && !(
298 Net::DRI::Util::xml_is_token( $e, 1, undef )
299 && Email::Valid->rfc822($e)
300 )
301 );
302 } else {
303 0 ▶ $er .= " $e "
Branch: 1 branch
BranchTrueFalseTotal
if $e and not Net::DRI::Util::xml_is_token($e, 3, 16) 0 0 0
Condition0%0/3
$e and not Net::DRI::Util::xml_is_token($e, 3, 16)
!ll&&!rl&&r
000
MC/DC0%0/2
$e and not Net::DRI::Util::xml_is_token($e, 3, 16)
$e not Net::DRI::Util::xml_is_token($e, 3, 16)
Truth table0%0/3
A and not(B)
A= $eB= not Net::DRI::Util::xml_is_token($e, 3, 16)
ABresult
0X0
100
111
304 if ( $e
305 && !Net::DRI::Util::xml_is_token( $e, 3, 16 ) );
306 }
307 0 ▶ push @errs, "$el:$er" if ($er);
Branch: 1 branch
BranchTrueFalseTotal
if $er 0 0 0
308 }
309 }
310 }
311  
312 ## Check that xdisclose only contains mobilePhone
313 0 ▶ if ( my $d = $self->xdisclose() ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $d = $self->xdisclose) 0 0 0
314 0 ▶ unless ( $d
Branch: 1 branch
BranchTrueFalseTotal
unless ($d and ref $d eq "HASH" and scalar keys %$d == 1 and $d->{"mobilePhone"} == 1 || $d->{"mobilePhone"} == 0) 0 0 0
Condition0%0/12
$d and ref $d eq "HASH" and scalar keys %$d == 1 and $d->{"mobilePhone"} == 1 || $d->{"mobilePhone"} == 0
!ll&&!rl&&r
000
$d and ref $d eq "HASH" and scalar keys %$d == 1
!ll&&!rl&&r
000
$d and ref $d eq "HASH"
!ll&&!rl&&r
000
$d->{"mobilePhone"} == 1 or $d->{"mobilePhone"} == 0
l!l&&r!l&&!r
000
MC/DC0%0/5
$d and ref $d eq "HASH" and scalar keys %$d == 1 and $d->{"mobilePhone"} == 1 || $d->{"mobilePhone"} == 0
$d ref $d eq "HASH" scalar keys %$d == 1 $d->{"mobilePhone"} == 1 $d->{"mobilePhone"} == 0
Truth table0%0/6
A and B and C and D or E
A= $dB= ref $d eq "HASH"C= scalar keys %$d == 1D= $d->{"mobilePhone"} == 1E= $d->{"mobilePhone"} == 0
ABCDEresult
0XXXX0
10XXX0
110XX0
111000
1111X1
111011
315 && ( ref($d) eq 'HASH' )
316 && ( scalar( keys(%$d) ) == 1 )
317 && ( $d->{mobilePhone} == 1 || $d->{mobilePhone} == 0 ) )
318 {
319 0 push @errs, 'xdisclose';
320 }
321 }
322 Net::DRI::Exception::usererr_invalid_parameters(
323 0 ▶ 'Invalid contact information: ' . join( '/', @errs ) )
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
324 if @errs;
325 0 return 1; ## everything ok.
326 }
327  
328 sub init {
329 0 ▶ my ( $self, $what, $ndr ) = @_;
Subroutine init: not called CC=6 SCAR=37.4
Pod undocumented
330  
331 0 ▶ if ( $what eq 'create' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($what eq "create") 0 0 0
332 0 my $a = $self->auth();
333 $self->auth( { pw => '' } )
334 0 ▶ unless ( $a && ( ref($a) eq 'HASH' ) && exists( $a->{pw} ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $a and ref $a eq "HASH" and exists $a->{"pw"} 0 0 0
Condition0%0/6
$a and ref $a eq "HASH" and exists $a->{"pw"}
!ll&&!rl&&r
000
$a and ref $a eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/3
$a and ref $a eq "HASH" and exists $a->{"pw"}
$a ref $a eq "HASH" exists $a->{"pw"}
Truth table0%0/4
A and B and C
A= $aB= ref $a eq "HASH"C= exists $a->{"pw"}
ABCresult
0XX0
10X0
1100
1111
335 ; ## Mandatory in EPP
336 0 ▶ $self->srid('auto')
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->srid 0 0 0
337 unless defined( $self->srid() ); ## we can not choose the ID
338 }
339 0 return;
340 }
341  
342 ####################################################################################################
343 1 1;
↑ Summary DRI/Data/Contact/AFNIC.pm »