DRI/Data/Contact/NO.pm

filter: Statementstmt 24.2% 23 / 95 Branchbran 0.0% 0 / 80 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 / 358 CC 83 SCAR 85.7
CC
83
Cov
8%
validate
6162.0
init
42.0
BEGIN
1.0
CRAP 5284.6
↑ Summary DRI/Data/Contact/AFNIC.pm »
1 ## Domain Registry Interface, Handling of contact data for .NO
2 ##
3 ## Copyright (c) 2008-2011,2014,2019 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-2011,2014,2019 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 0 ▶sub validate {
Subroutine validate: not called CC=78 SCAR=87.3
Pod undocumented
151 0 my ( $self, $change ) = @_;
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  
167 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters(
Branch: 1 branch
BranchTrueFalseTotal
unless $self->type 0 0 0
168 'Invalid contact information: type mandatory')
169 unless ( $self->type() );
170 }
171  
172 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
173 push @errs, 'name'
174 if ( $self->name()
175 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
176 ( $self->name() ) );
177 push @errs, 'org'
178 if ( $self->org()
179 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
180 ( $self->org() ) );
181  
182 0 my @rs = ( $self->street() );
183  
184 0 foreach my $i ( 0, 1 ) {
185 0 ▶ next unless $rs[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless $rs[$i] 0 0 0
186 push @errs, 'street'
187 if (
188 0 ( ref( $rs[$i] ) ne 'ARRAY' ) || ( @{ $rs[$i] } > 3 ) || (
189 grep {
190 0 !Net::DRI::Util::xml_is_normalizedstring( $_, undef, 255 )
191 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
192 )
193 );
194 }
195  
196 push @errs, 'city'
197 if ( $self->city()
198 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
199 ( $self->city() ) );
200 push @errs, 'sp'
201 if ( $self->sp()
202 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
203 ( $self->sp() ) );
204 push @errs, 'pc'
205 if ( $self->pc()
206 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
207 ( $self->pc() ) );
208 push @errs, 'cc'
209 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
210 ( $self->cc() ) );
211 push @errs, 'cc'
212 if ( $self->cc()
213 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
214 ( $self->cc() ) );
215  
216 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
217 if ( $self->voice()
218 && !Net::DRI::Util::xml_is_token( $self->voice(), undef, 17 )
219 && $self->voice() !~ m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx );
220 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
221 if ( $self->fax()
222 && !Net::DRI::Util::xml_is_token( $self->fax(), undef, 17 )
223 && $self->fax() !~ m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx );
224 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
225 if (
226 $self->email()
227 && !(
228 Net::DRI::Util::xml_is_token( $self->email(), 1, undef )
229 && Email::Valid->rfc822( $self->email() )
230 )
231 );
232  
233 0 my $ra = $self->auth();
234 push @errs, 'auth'
235 if ( $ra
236 && ( ref($ra) eq 'HASH' )
237 && exists( $ra->{pw} )
238 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
239  
240 # .NO
241 0 my $t = $self->type();
242 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
243  
244 0 $t = $self->identity();
245  
246 0 ▶ if ($t) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t) 0 0 0
247 0 my $ty = $t->{type};
248 0 my $va = $t->{value};
249 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
250 if ( $ty
251 && $ty
252 !~ m/^(?:organizationNumber|localIdentity|nationalIdentityNumber|anonymousPersonIdentifier)$/mx
253 );
254  
255 # let the server handle further validation of what identity syntax
256 # and values are legal
257 }
258 0 $t = $self->mobilephone();
259 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
260 if ( $t
261 && !Net::DRI::Util::xml_is_token( $t, undef, 17 )
262 && $t !~ m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/mx );
263  
264 #
265 0 foreach my $el ( 'organization', 'rolecontact', 'xemail' ) {
266 0 ▶ if ( $t = $self->$el() ) { # option, as scalar or array
Branch: 1 branch
BranchTrueFalseTotal
if ($t = $self->$el) 0 0 0
267 0 my @em;
268 my $er;
269  
270 0 ▶ if ($change) {
Branch: 1 branch
BranchTrueFalseTotal
if ($change) { } 0 0 0
271 0 ▶ if ( ref($t) eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $t eq 'HASH') { } 0 0 0
272 0 foreach my $s ( 'add', 'del' ) {
273 0 my $e = $t->{$s};
274 0 ▶ if ( ref($e) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $e eq 'ARRAY') { } 0 0 0
275 0 ▶ push @em, @$e if (@$e);
Branch: 1 branch
BranchTrueFalseTotal
if @$e 0 0 0
276 } else {
277 0 ▶ push @em, $e if ($e);
Branch: 1 branch
BranchTrueFalseTotal
if $e 0 0 0
278 }
279 }
280 } else {
281 0 $er .= ":update needs an add/del hash:";
282 }
283 } else {
284 0 ▶ if ( ref($t) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $t eq 'ARRAY') { } 0 0 0
285 0 ▶ push @em, @$t if (@$t);
Branch: 1 branch
BranchTrueFalseTotal
if @$t 0 0 0
286 } else {
287 0 ▶ push @em, $t if ($t);
Branch: 1 branch
BranchTrueFalseTotal
if $t 0 0 0
288 }
289 }
290 0 foreach my $e (@em) {
291 0 ▶ if ( $el eq 'xemail' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($el eq 'xemail') { } 0 0 0
292 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
293 if (
294 $e
295 && !(
296 Net::DRI::Util::xml_is_token( $e, 1, undef )
297 && Email::Valid->rfc822($e)
298 )
299 );
300 } else {
301 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
302 if ( $e
303 && !Net::DRI::Util::xml_is_token( $e, 3, 16 ) );
304 }
305 0 ▶ push @errs, "$el:$er" if ($er);
Branch: 1 branch
BranchTrueFalseTotal
if $er 0 0 0
306 }
307 }
308 }
309  
310 ## Check that xdisclose only contains mobilePhone
311 0 ▶ if ( my $d = $self->xdisclose() ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $d = $self->xdisclose) 0 0 0
312 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
313 && ( ref($d) eq 'HASH' )
314 && ( scalar( keys(%$d) ) == 1 )
315 && ( $d->{mobilePhone} == 1 || $d->{mobilePhone} == 0 ) )
316 {
317 0 push @errs, 'xdisclose';
318 }
319 }
320 Net::DRI::Exception::usererr_invalid_parameters(
321 0 ▶ 'Invalid contact information: ' . join( '/', @errs ) )
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
322 if @errs;
323 0 return 1; ## everything ok.
324 }
325  
326 0 ▶sub init {
Subroutine init: not called CC=6 SCAR=37.4
Pod undocumented
327 0 my ( $self, $what, $ndr ) = @_;
328  
329 0 ▶ if ( $what eq 'create' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($what eq "create") 0 0 0
330 0 my $a = $self->auth();
331 $self->auth( { pw => '' } )
332 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
333 ; ## Mandatory in EPP
334 0 ▶ $self->srid('auto')
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->srid 0 0 0
335 unless defined( $self->srid() ); ## we can not choose the ID
336 }
337 0 return;
338 }
339  
340 ####################################################################################################
341 1 1;
↑ Summary DRI/Data/Contact/AFNIC.pm »