DRI/Data/Contact.pm

filter: Statementstmt 51.7% 76 / 147 Branchbran 32.0% 25 / 78 Conditioncond 7.0% 5 / 71 MC/DCmcdc 4.7% 2 / 42 Subroutinesub 81.8% 18 / 22 Podpod 54.5% 6 / 11 totaltotal 35.5% 132 / 371 CC 69 SCAR 66.1
CC
69
Cov
36%
validate
1640.0
as_string
90.0
get
12.5
CRAP 740.4
« DRI/Protocol/EPP/Extensions/CAT/Domain.pm ↑ Summary DRI/Data/Contact/CIRA.pm »
1 ## Domain Registry Interface, Handling of contact data
2 ##
3 ## Copyright (c) 2005-2010,2013-2015 Patrick Mevzek <netdri@dotandco.com>. 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;
16  
17 83 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 83 ▶use base qw(Class::Accessor::Chained); ## provides a new() method
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 83 our @ATTRS=qw(name org street city sp pc cc email voice fax loid roid srid auth disclose);
24 83 __PACKAGE__->register_attributes(@ATTRS);
25  
26 83 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 83 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 83 ▶use Email::Valid;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 83 ▶use Encode (); ## we need here direct use of Encode, not through Net::DRI::Util::encode_* as we need the default substitution for unknown data
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 =pod
33  
34 =head1 NAME
35  
36 Net::DRI::Data::Contact - Handle contact data, modeled from EPP for Net::DRI
37  
38 =head1 DESCRIPTION
39  
40 This base class encapsulates all data for a contact as defined in EPP (RFC4933).
41 It can (and should) be subclassed for TLDs needing to store other data for a contact.
42 All subclasses must have a validate() method that takes care of verifying contact data,
43 and an id() method returning an opaque value, unique per contact (in a given registry).
44  
45 The following methods are both accessors and mutators :
46 as mutators, they can be called in chain, as they all return the object itself.
47  
48 Postal information through name() org() street() city() sp() pc() cc() can be provided twice.
49 EPP allows a localized form (content is in unrestricted UTF-8) and internationalized form
50 (content MUST be represented in a subset of UTF-8 that can be represented
51 in the 7-bit US-ASCII character set). Not all registries support both forms.
52  
53 When setting values, you pass two elements as a list (first the localized form,
54 then the internationalized one), or only one element that will be taken as the localized form.
55 When getting values, in list context you get back both values, in scalar context you get
56 back the first one, that is the localized form.
57  
58 You can also use methods int2loc() and loc2int() to create one version from the other.
59 These 2 methods may be used automatically inside Net::DRI as needed, depending on what
60 the registry expects and the operation conducted (like a contact create).
61  
62 =head1 METHODS
63  
64 =head2 loid()
65  
66 local object ID for this contact, never sent to registry (can be used to track the local db id of this object)
67  
68 =head2 srid()
69  
70 server ID, ID of the object as known by the registry in which it was created
71  
72 =head2 id()
73  
74 an alias (needed for Net::DRI::Data::ContactSet) of the previous method
75  
76 =head2 roid()
77  
78 registry/remote object id (internal to a registry)
79  
80 =head2 name()
81  
82 name of the contact
83  
84 =head2 org()
85  
86 organization of the contact
87  
88 =head2 street()
89  
90 street address of the contact (ref array of up to 3 elements)
91  
92 =head2 city()
93  
94 city of the contact
95  
96 =head2 sp()
97  
98 state/province of the contact
99  
100 =head2 pc()
101  
102 postal code of the contact
103  
104 =head2 cc()
105  
106 alpha2 country code of the contact (will be verified against list of valid country codes)
107  
108 =head2 email()
109  
110 email address of the contact
111  
112 =head2 voice()
113  
114 voice number of the contact (in the form +CC.NNNNNNNNxEEE)
115  
116 =head2 fax()
117  
118 fax number of the contact (same form as above)
119  
120 =head2 auth()
121  
122 authentication for this contact (hash ref with a key 'pw' and a value being the password)
123  
124 =head2 disclose()
125  
126 privacy settings related to this contact (see RFC)
127  
128 =head2 int2loc()
129  
130 create the localized part from the internationalized part ; existing internationalized data is overwritten
131  
132 =head2 loc2int()
133  
134 create the internationalized part from the localized part ; existing localized data is overwritten ;
135 as the internationalized part must be a subset of UTF-8 when the localized one can be the full UTF-8,
136 this operation may creates undefined characters (?) as result
137  
138 =head2 as_string()
139  
140 return a string formed with all data contained in this contact object ; this is mostly useful for debugging and logging, this
141 string should not be parsed as its format is not guaranteed to remain stable, you should use the above accessors
142  
143 =head2 attributes()
144  
145 return an array of attributes name available in this contact object (taking into account any subclass specific attribute)
146  
147 =head1 SUPPORT
148  
149 For now, support questions should be sent to:
150  
151 E<lt>netdri@dotandco.comE<gt>
152  
153 Please also see the SUPPORT file in the distribution.
154  
155 =head1 SEE ALSO
156  
157 http://www.dotandco.com/services/software/Net-DRI/
158  
159 =head1 AUTHOR
160  
161 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
162  
163 =head1 COPYRIGHT
164  
165 Copyright (c) 2005-2010,2013-2015 Patrick Mevzek <netdri@dotandco.com>.
166 All rights reserved.
167  
168 This program is free software; you can redistribute it and/or modify
169 it under the terms of the GNU General Public License as published by
170 the Free Software Foundation; either version 2 of the License, or
171 (at your option) any later version.
172  
173 See the LICENSE file that comes with this distribution for more details.
174  
175 =cut
176  
177 ####################################################################################################
178 ## Needed for ContactSet
179 18 ▶sub id { my ($self,@args)=@_; return $self->srid(@args); }
Subroutine id: called CC=1 SCAR=0.0
Pod documented
180  
181 sub register_attributes
182 {
183 114 ▶ my ($class,@a)=@_;
Subroutine register_attributes: called CC=2 SCAR=6.9
Pod undocumented
184 114 __PACKAGE__->mk_accessors(@a);
185 83 ▶ no strict 'refs'; ## no critic (ProhibitNoStrict)
Subroutine BEGIN: called CC=1 SCAR=0.0
186 114 ▶ ${$class.'::ATTRS'}=($class eq 'Net::DRI::Data::Contact')? \@a : [ @ATTRS,@a ];
Branch: 1 branch
BranchTrueFalseTotal
$class eq 'Net::DRI::Data::Contact' ? : 83 31 114
187 114 return ${$class.'::ATTRS'};
188 }
189  
190 sub attributes
191 {
192 0 ▶ my $class=shift;
Subroutine attributes: not called CC=2 SCAR=12.6
Pod documented
193 0 ▶ $class=ref($class) || $class;
Condition0%0/3
ref $class || $class
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table0%0/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
194 83 ▶ no strict 'refs'; ## no critic (ProhibitNoStrict)
Subroutine BEGIN: called CC=1 SCAR=0.0
195 0 return @{${$class.'::ATTRS'}};
196 }
197  
198 ## Overrides method in Class::Accessor, needed for int/loc data
199 sub get
200 {
201 70 ▶ my ($self,$what)=@_;
Subroutine get: called CC=12 SCAR=25.2
Pod documented
202 70 ▶ return unless defined $what && $what && exists $self->{$what};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $what and $what and exists $self->{$what} 30 40 70
Condition50%3/6
defined $what and $what and exists $self->{$what}
!ll&&!rl&&r
03040
defined $what and $what
!ll&&!rl&&r
0070
MC/DC33%1/3
defined $what and $what and exists $self->{$what}
defined $what $what exists $self->{$what}
Truth table50%2/4
A and B and C
A= defined $whatB= $whatC= exists $self->{$what}
ABCresult
0XX0
10X0
1100
1111
203 40 my $d=$self->{$what};
204 40 ▶ return $d unless ($what=~m/^(name|org|street|city|sp|pc|cc)$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $what =~ /^(name|org|street|city|sp|pc|cc)$/ 18 22 40
205  
206 ## Special case for street because it is always a ref array, but a complicate one, we have either
207 ## [ X, Y, Z ] (with Y and/or Z optional)
208 ## [ undef, [ X, Y, Z ] ]
209 ## [ [ X, Y, Z ] , undef ]
210 ## [ [ X, Y, Z ], [ XX, YY, ZZ ] ]
211 ## [ undef, undef ]
212 22 ▶ if ($what eq 'street')
Branch: 1 branch
BranchTrueFalseTotal
if ($what eq 'street') { } 9 13 22
213 {
214 9 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid street information, should be one or two ref arrays of up to 3 elements each') unless ref $d eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $d eq "ARRAY" 0 9 9
215 9 ▶ return wantarray ? ($d, undef) : $d unless 2==grep { ! defined $_ || ref $_ eq 'ARRAY' } @$d;
Branch: 3 branches
BranchTrueFalseTotal
unless 2 == grep({not defined $_ or ref $_ eq "ARRAY";} @$d) 4 5 9
not defined $_ or ref $_ eq "ARRAY" 22 0 22
wantarray ? : 3 1 4
216 } else
217 {
218 13 ▶ return $d unless ref $d eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $d eq "ARRAY" 3 10 13
219 }
220 15 ▶ return wantarray ? @$d : $d->[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 13 2 15
221 }
222  
223 sub loc2int
224 {
225 1 ▶ my $self=shift;
Subroutine loc2int: called CC=5 SCAR=17.6
Pod documented
226 1 foreach my $f (qw/name org city sp pc cc/)
227 {
228 6 my @c=$self->$f();
229 6 ▶ $c[1]=defined $c[0] ? Encode::encode('ascii',$c[0],0) : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $c[0] ? : 1 5 6
230 6 $self->$f(@c);
231 }
232 1 my @c=$self->street();
233 1 ▶ if (defined $c[0])
Branch: 1 branch
BranchTrueFalseTotal
if (defined $c[0]) { } 0 1 1
234 {
235 0 ▶ $c[1]=[ map { defined $_ ? Encode::encode('ascii',$_,0) : undef } @{$c[0]} ];
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
236 } else
237 {
238 1 $c[1]=$c[0]=[];
239 }
240 1 $self->street(@c);
241 1 return $self;
242 }
243  
244 sub int2loc
245 {
246 1 ▶ my $self=shift;
Subroutine int2loc: called CC=2 SCAR=6.9
Pod documented
247 1 foreach my $f (qw/name org street city sp pc cc/)
248 {
249 7 my @c=$self->$f();
250 7 $c[0]=$c[1]; ## internationalized form is a subset of UTF-8 and localized form is full UTF-8
251 7 $self->$f(@c);
252 }
253 1 return $self;
254 }
255  
256 2 ▶sub has_loc { return shift->_has(0); }
Subroutine has_loc: called CC=1 SCAR=0.0
Pod undocumented
257 2 ▶sub has_int { return shift->_has(1); }
Subroutine has_int: called CC=1 SCAR=0.0
Pod undocumented
258 sub _has
259 {
260 4 ▶ my ($self,$pos)=@_;
Subroutine _has: called CC=4 SCAR=13.9
261 4 my @d=map { ($self->$_())[$pos] } qw/name org city sp pc cc/;
262 4 my $s=($self->street())[$pos];
263 4 ▶ push @d,@$s if defined $s && ref $s eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if defined $s and ref $s eq "ARRAY" 3 1 4
Condition66%2/3
defined $s and ref $s eq "ARRAY"
!ll&&!rl&&r
103
MC/DC50%1/2
defined $s and ref $s eq "ARRAY"
defined $s ref $s eq "ARRAY"
Truth table66%2/3
A and B
A= defined $sB= ref $s eq "ARRAY"
ABresult
0X0
100
111
264 4 ▶ return (grep { defined } @d)? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
grep({defined $_;} @d) ? : 3 1 4
265 }
266  
267 sub validate ## See RFC4933,§4
268 {
269 0 ▶ my ($self,$change)=@_;
Subroutine validate: not called CC=40 SCAR=74.0
Pod undocumented
270 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
271 0 my @errs;
272  
273 0 ▶ if (!$change)
Branch: 1 branch
BranchTrueFalseTotal
unless ($change) 0 0 0
274 {
275 0 ▶ my @missing=grep { my $r=scalar $self->$_(); (defined $r && length $r)? 0 : 1 } qw/name city cc email auth srid/;
Branch: 1 branch
BranchTrueFalseTotal
defined $r && length $r ? : 0 0 0
Condition0%0/3
defined $r and length $r
!ll&&!rl&&r
000
MC/DC0%0/2
defined $r and length $r
defined $r length $r
Truth table0%0/3
A and B
A= defined $rB= length $r
ABresult
0X0
100
111
276 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('Mandatory contact information missing: '.join('/',@missing)) if @missing;
Branch: 1 branch
BranchTrueFalseTotal
if @missing 0 0 0
277 0 ▶ push @errs,'srid' unless Net::DRI::Util::xml_is_token($self->srid(),3,16);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::xml_is_token($self->srid, 3, 16) 0 0 0
278 }
279  
280 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
281 0 ▶ push @errs,'name' if ($self->name() && grep { !Net::DRI::Util::xml_is_normalizedstring($_,1,255) } ($self->name()));
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
282 0 ▶ push @errs,'org' if ($self->org() && grep { !Net::DRI::Util::xml_is_normalizedstring($_,undef,255) } ($self->org()));
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
283  
284 0 my @rs=($self->street());
285 0 foreach my $i (0,1)
286 {
287 0 ▶ next unless defined $rs[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $rs[$i] 0 0 0
288 0 ▶ push @errs,'street' if ((ref($rs[$i]) ne 'ARRAY') || (@{$rs[$i]} > 3) || (grep { !Net::DRI::Util::xml_is_normalizedstring($_,undef,255) } @{$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
289 }
290  
291 0 ▶ push @errs,'city' if ($self->city() && grep { !Net::DRI::Util::xml_is_normalizedstring($_,1,255) } ($self->city()));
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
292 0 ▶ push @errs,'sp' if ($self->sp() && grep { !Net::DRI::Util::xml_is_normalizedstring($_,undef,255) } ($self->sp()));
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
293 0 ▶ push @errs,'pc' if ($self->pc() && grep { !Net::DRI::Util::xml_is_token($_,undef,16) } ($self->pc()));
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
294 0 ▶ push @errs,'cc' if ($self->cc() && grep { !Net::DRI::Util::xml_is_token($_,2,2) } ($self->cc()));
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
295 0 ▶ push @errs,'cc' if ($self->cc() && grep { !exists($Net::DRI::Util::CCA2{uc($_)}) } ($self->cc()));
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
296  
297 0 ▶ push @errs,'voice' if ($self->voice() && ! ($self->voice()=~m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/));
Branch: 1 branch
BranchTrueFalseTotal
if $self->voice and not $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/ 0 0 0
Condition0%0/3
$self->voice and not $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
!ll&&!rl&&r
000
MC/DC0%0/2
$self->voice and not $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
$self->voice not $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
Truth table0%0/3
A and not(B)
A= $self->voiceB= not $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
ABresult
0X0
100
111
298 0 ▶ push @errs,'fax' if ($self->fax() && ! ($self->fax()=~m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/));
Branch: 1 branch
BranchTrueFalseTotal
if $self->fax and not $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/ 0 0 0
Condition0%0/3
$self->fax and not $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
!ll&&!rl&&r
000
MC/DC0%0/2
$self->fax and not $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
$self->fax not $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
Truth table0%0/3
A and not(B)
A= $self->faxB= not $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
ABresult
0X0
100
111
299 0 ▶ push @errs,'email' if ($self->email() && ! (Net::DRI::Util::xml_is_token($self->email(),1,undef) && Email::Valid->rfc822($self->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
300  
301 0 my $ra=$self->auth();
302 0 ▶ push @errs,'auth' if ($ra && (ref($ra) eq 'HASH') && exists($ra->{pw}) && !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
303  
304 ## Nothing checked for disclose
305  
306 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
307 0 return 1; ## everything ok.
308 }
309  
310 sub as_string
311 {
312 0 ▶ my ($self,$sep)=@_;
Subroutine as_string: not called CC=9 SCAR=45.0
Pod documented
313 0 ▶ $sep='|' unless (defined($sep) && $sep);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $sep and $sep 0 0 0
Condition0%0/3
defined $sep and $sep
!ll&&!rl&&r
000
MC/DC0%0/2
defined $sep and $sep
defined $sep $sep
Truth table0%0/3
A and B
A= defined $sepB= $sep
ABresult
0X0
100
111
314 0 my $st=$self->street();
315 0 ▶ my @v=grep { defined } ($self->srid(),$self->name(),$self->org(),defined($st)? join(' // ',@$st) : undef,$self->city(),$self->sp(),$self->pc(),$self->cc(),$self->voice(),$self->fax(),$self->email());
Branch: 1 branch
BranchTrueFalseTotal
defined $st ? : 0 0 0
316 0 my @ot=sort { $a cmp $b } grep { ! /^(?:name|org|street|city|sp|pc|cc|email|voice|fax|loid|roid|srid|auth|disclose)$/ } keys %$self;
317 0 foreach my $ot (@ot) ## extra attributes defined in subclasses
318 {
319 0 my $v=$self->$ot();
320 0 ▶ next unless defined($v);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $v 0 0 0
321 0 ▶ if (ref($v) eq 'HASH')
Branch: 1 branch
BranchTrueFalseTotal
if (ref $v eq 'HASH') { } 0 0 0
322 {
323 0 my @iv=sort { $a cmp $b } keys %$v;
324 0 my @r;
325 0 foreach my $k (@iv)
326 {
327 0 ▶ push @r,sprintf('%s.%s=%s',$ot,$k,defined($v->{$k})? $v->{$k} : '<undef>');
Branch: 1 branch
BranchTrueFalseTotal
defined $v->{$k} ? : 0 0 0
328 }
329 0 push @v,join(' ',@r);
330 } else
331 {
332 0 push @v,$ot.'='.$v;
333 }
334 }
335  
336 0 my $c=ref($self);
337 0 $c=~s/^Net::DRI::Data:://;
338 0 return '('.$c.') '.join($sep,@v);
339 }
340  
341 sub clone
342 {
343 0 ▶ my ($self)=@_;
Subroutine clone: not called CC=1 SCAR=6.9
Pod undocumented
344 0 my $new=Net::DRI::Util::deepcopy($self);
345 0 return $new;
346 }
347  
348 ####################################################################################################
349 83 1;
« DRI/Protocol/EPP/Extensions/CAT/Domain.pm ↑ Summary DRI/Data/Contact/CIRA.pm »