DRI/Data/Contact/AFNIC.pm

filter: Statementstmt 28.7% 29 / 101 Branchbran 0.0% 0 / 88 Conditioncond 0.0% 0 / 104 MC/DCmcdc 0.0% 0 / 58 Subroutinesub 46.6% 7 / 15 Podpod 0.0% 0 / 8 totaltotal 9.6% 36 / 374 CC 80 SCAR 79.6
CC
80
Cov
10%
validate
4160.0
validate_registrant
210.0
init
20.0
CRAP 2864.6
« DRI/Data/Contact/NO.pm ↑ Summary DRI/Data/Contact/AT.pm »
1 ## Domain Registry Interface, Handling of contact data for AFNIC
2 ##
3 ## Copyright (c) 2006,2008-2010,2012-2014 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::AFNIC;
16  
17 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use base qw/Net::DRI::Data::Contact/;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 ▶use Email::Valid;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 1 __PACKAGE__->register_attributes(qw(firstname legal_form legal_form_other legal_id legal_id_type jo trademark birth vat qualification obsoleted));
29  
30 =pod
31  
32 =encoding utf8
33  
34 =head1 NAME
35  
36 Net::DRI::Data::Contact::AFNIC - Handle AFNIC contact data for Net::DRI
37  
38 =head1 DESCRIPTION
39  
40 This subclass of Net::DRI::Data::Contact adds accessors and validation for
41 AFNIC specific data.
42  
43 =head1 METHODS
44  
45 The following accessors/mutators can be called in chain, as they all return the object itself.
46  
47 =head2 firstname()
48  
49 Please note that for AFNIC data, the name() must be only the lastname, hence this extra firstname() method needed for contacts being individuals
50  
51 =head2 legal_form()
52  
53 for an organization, either 'A' or 'association' for non profit organization, 'S' or 'company' for company or 'other' for other types;
54 this must be set for contacts being moral entities
55  
56 =head2 legal_form_other()
57  
58 type of organization for other types
59  
60 =head2 legal_id()
61  
62 French SIREN/SIRET of organization
63  
64 =head2 jo()
65  
66 reference to an hash with 4 keys storing details about «Journal Officiel» :
67 date_declaration (Declaration date), date_publication (Publication date),
68 number (Announce number) and page (Announce page)
69  
70 a waldec key can also be present for the waldec id
71  
72 =head2 trademark()
73  
74 for trademarks, its number
75  
76 =head2 vat()
77  
78 vat number (not used by registry for now)
79  
80 =head2 birth()
81  
82 reference to an hash with 2 keys storing details about birth of contact :
83 date (Date of birth) and place (Place of birth)
84  
85 =head1 SUPPORT
86  
87 For now, support questions should be sent to:
88  
89 E<lt>netdri@dotandco.comE<gt>
90  
91 Please also see the SUPPORT file in the distribution.
92  
93 =head1 SEE ALSO
94  
95 http://www.dotandco.com/services/software/Net-DRI/
96  
97 =head1 AUTHOR
98  
99 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
100  
101 =head1 COPYRIGHT
102  
103 Copyright (c) 2006,2008-2010,2012-2014 Patrick Mevzek <netdri@dotandco.com>.
104 All rights reserved.
105  
106 This program is free software; you can redistribute it and/or modify
107 it under the terms of the GNU General Public License as published by
108 the Free Software Foundation; either version 2 of the License, or
109 (at your option) any later version.
110  
111 See the LICENSE file that comes with this distribution for more details.
112  
113 =cut
114  
115 ####################################################################################################
116  
117 1 our $LETTRES=qr(A-Z\x{00C0}\x{00C2}\x{00C7}\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{00CE}\x{00CF}\x{00D4}\x{00D9}\x{00DB}\x{00DC}\x{0178}\x{00C6}\x{0152}a-z\x{00E0}\x{00E2}\x{00E7}\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{00EE}\x{00EF}\x{00F4}\x{00F9}\x{00FB}\x{00FC}\x{00FF}\x{00E6}\x{0153});
118 1 our $NOM_LIBRE_ITEM=qr{[${LETTRES}0-9\(\)\.\[\]\?\+\*#&/!\@',><":-]+};
119 1 our $NOM_PROPRE_ITEM=qr{[${LETTRES}]+(('?(?:[${LETTRES}]+(?:\-?[${LETTRES}]+)?)+)|(?:\.?))};
120 1 our $NOM_PROPRE=qr{${NOM_PROPRE_ITEM}( +${NOM_PROPRE_ITEM})*};
121 1 our $ADRESSE_ITEM=qr{[${LETTRES}0-9\(\)\./',"#-]+};
122 1 our $NOM_COMMUNE_ITEM=qr{[${LETTRES}]+(?:['-]?[${LETTRES}]+)*};
123  
124 0 ▶sub is_nom_libre { return shift=~m/^(?:${NOM_LIBRE_ITEM} *)*[${LETTRES}0-9]+(?: *${NOM_LIBRE_ITEM}*)*$/; }
Subroutine is_nom_libre: not called CC=1 SCAR=6.9
Pod undocumented
125 0 ▶sub is_adresse { return shift=~m/^(?:${ADRESSE_ITEM} *)*[${LETTRES}]+(?: *${ADRESSE_ITEM})*$/; }
Subroutine is_adresse: not called CC=1 SCAR=6.9
Pod undocumented
126 0 ▶sub is_commune { return shift=~m/^${NOM_COMMUNE_ITEM}(?:(?:(?: *\/ *)|(?: +))${NOM_COMMUNE_ITEM})*(?: +(?:[cC][eE][dD][eE][xX]|[cC][dD][xX])(?: +[0-9]+)?)?$/; }
Subroutine is_commune: not called CC=1 SCAR=6.9
Pod undocumented
127 0 ▶sub is_code_fr { return shift=~m/^(?:FR|RE|MQ|GP|GF|TF|NC|PF|WF|PM|YT)$/; }
Subroutine is_code_fr: not called CC=1 SCAR=6.9
Pod undocumented
128 0 ▶sub is_dep_fr { return shift=~m/^(?:0[1-9])|(?:[1345678][0-9])|(?:2[1-9ABab])|(?:9[0-5])|(?:97[1-5])|(?:98[5-8])$/; }
Subroutine is_dep_fr: not called CC=1 SCAR=6.9
Pod undocumented
129  
130 sub validate
131 0 ▶{
Subroutine validate: not called CC=64 SCAR=83.3
Pod undocumented
132 0 my ($self,$change)=@_;
133 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
134  
135 0 $self->SUPER::validate(1); ## will trigger an Exception if problem
136  
137 0 my @errs;
138 0 ▶ push @errs,'srid' if ($self->srid() && $self->srid()!~m/^[A-Z]+(?:[1-9][0-9]*)?(?:-FRNIC)?$/i);
Branch: 1 branch
BranchTrueFalseTotal
if $self->srid and not $self->srid =~ /^[A-Z]+(?:[1-9][0-9]*)?(?:-FRNIC)?$/i 0 0 0
Condition0%0/3
$self->srid and not $self->srid =~ /^[A-Z]+(?:[1-9][0-9]*)?(?:-FRNIC)?$/i
!ll&&!rl&&r
000
MC/DC0%0/2
$self->srid and not $self->srid =~ /^[A-Z]+(?:[1-9][0-9]*)?(?:-FRNIC)?$/i
$self->srid not $self->srid =~ /^[A-Z]+(?:[1-9][0-9]*)?(?:-FRNIC)?$/i
Truth table0%0/3
A and not(B)
A= $self->sridB= not $self->srid =~ /^[A-Z]+(?:[1-9][0-9]*)?(?:-FRNIC)?$/i
ABresult
0X0
100
111
139 0 ▶ push @errs,'name' if ($self->name() && ($self->name()!~m/^${NOM_PROPRE}$/ || ! is_nom_libre($self->name())));
Branch: 1 branch
BranchTrueFalseTotal
if $self->name and not $self->name =~ /^$Net::DRI::Data::Contact::AFNIC::NOM_PROPRE$/ && is_nom_libre($self->name) 0 0 0
Condition0%0/6
$self->name and not $self->name =~ /^$Net::DRI::Data::Contact::AFNIC::NOM_PROPRE$/ && is_nom_libre($self->name)
!ll&&!rl&&r
000
$self->name =~ /^$Net::DRI::Data::Contact::AFNIC::NOM_PROPRE$/ && is_nom_libre($self->name)
!ll&&!rl&&r
000
MC/DC0%0/3
$self->name and not $self->name =~ /^$Net::DRI::Data::Contact::AFNIC::NOM_PROPRE$/ && is_nom_libre($self->name)
$self->name $self->name =~ /^$Net::DRI::Data::Contact::AFNIC::NOM_PROPRE$/ is_nom_libre($self->name)
Truth table0%0/4
A and not(B && C)
A= $self->nameB= $self->name =~ /^$Net::DRI::Data::Contact::AFNIC::NOM_PROPRE$/C= is_nom_libre($self->name)
ABCresult
0XX0
1110
10X1
1101
140 0 ▶ push @errs,'firstname' if ($self->firstname() && $self->firstname()!~m/^${NOM_PROPRE}$/);
Branch: 1 branch
BranchTrueFalseTotal
if $self->firstname and not $self->firstname =~ /^$Net::DRI::Data::Contact::AFNIC::NOM_PROPRE$/ 0 0 0
Condition0%0/3
$self->firstname and not $self->firstname =~ /^$Net::DRI::Data::Contact::AFNIC::NOM_PROPRE$/
!ll&&!rl&&r
000
MC/DC0%0/2
$self->firstname and not $self->firstname =~ /^$Net::DRI::Data::Contact::AFNIC::NOM_PROPRE$/
$self->firstname not $self->firstname =~ /^$Net::DRI::Data::Contact::AFNIC::NOM_PROPRE$/
Truth table0%0/3
A and not(B)
A= $self->firstnameB= not $self->firstname =~ /^$Net::DRI::Data::Contact::AFNIC::NOM_PROPRE$/
ABresult
0X0
100
111
141 0 ▶ push @errs,'org' if ($self->org() && ! is_nom_libre($self->org()));
Branch: 1 branch
BranchTrueFalseTotal
if $self->org and not is_nom_libre($self->org) 0 0 0
Condition0%0/3
$self->org and not is_nom_libre($self->org)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->org and not is_nom_libre($self->org)
$self->org not is_nom_libre($self->org)
Truth table0%0/3
A and not(B)
A= $self->orgB= not is_nom_libre($self->org)
ABresult
0X0
100
111
142  
143 0 ▶ push @errs,'legal_form' if ($self->legal_form() && $self->legal_form()!~m/^(?:company|association|other)$/);
Branch: 1 branch
BranchTrueFalseTotal
if $self->legal_form and not $self->legal_form =~ /^(?:company|association|other)$/ 0 0 0
Condition0%0/3
$self->legal_form and not $self->legal_form =~ /^(?:company|association|other)$/
!ll&&!rl&&r
000
MC/DC0%0/2
$self->legal_form and not $self->legal_form =~ /^(?:company|association|other)$/
$self->legal_form not $self->legal_form =~ /^(?:company|association|other)$/
Truth table0%0/3
A and not(B)
A= $self->legal_formB= not $self->legal_form =~ /^(?:company|association|other)$/
ABresult
0X0
100
111
144 0 ▶ push @errs,'legal_form_other' if ($self->legal_form_other() && ! is_nom_libre($self->legal_form_other()));
Branch: 1 branch
BranchTrueFalseTotal
if $self->legal_form_other and not is_nom_libre($self->legal_form_other) 0 0 0
Condition0%0/3
$self->legal_form_other and not is_nom_libre($self->legal_form_other)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->legal_form_other and not is_nom_libre($self->legal_form_other)
$self->legal_form_other not is_nom_libre($self->legal_form_other)
Truth table0%0/3
A and not(B)
A= $self->legal_form_otherB= not is_nom_libre($self->legal_form_other)
ABresult
0X0
100
111
145 0 ▶ if ($self->legal_id_type())
Branch: 1 branch
BranchTrueFalseTotal
if ($self->legal_id_type) 0 0 0
146 {
147 0 ▶ push @errs,'legal_id_type' if $self->legal_id_type()!~m/^(?:siren|duns|local)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->legal_id_type =~ /^(?:siren|duns|local)$/ 0 0 0
148 0 ▶ push @errs,'legal_id' if ($self->legal_id() && $self->legal_id_type() eq 'sirent' && $self->legal_id()!~m/^[0-9]{9}(?:[0-9]{5})?$/);
Branch: 1 branch
BranchTrueFalseTotal
if $self->legal_id and $self->legal_id_type eq "sirent" and not $self->legal_id =~ /^[0-9]{9}(?:[0-9]{5})?$/ 0 0 0
Condition0%0/6
$self->legal_id and $self->legal_id_type eq "sirent" and not $self->legal_id =~ /^[0-9]{9}(?:[0-9]{5})?$/
!ll&&!rl&&r
000
$self->legal_id and $self->legal_id_type eq "sirent"
!ll&&!rl&&r
000
MC/DC0%0/3
$self->legal_id and $self->legal_id_type eq "sirent" and not $self->legal_id =~ /^[0-9]{9}(?:[0-9]{5})?$/
$self->legal_id $self->legal_id_type eq "sirent" not $self->legal_id =~ /^[0-9]{9}(?:[0-9]{5})?$/
Truth table0%0/4
A and B and not(C)
A= $self->legal_idB= $self->legal_id_type eq "sirent"C= not $self->legal_id =~ /^[0-9]{9}(?:[0-9]{5})?$/
ABCresult
0XX0
10X0
1100
1111
149 }
150  
151 0 my $jo=$self->jo();
152 0 ▶ if ($jo)
Branch: 1 branch
BranchTrueFalseTotal
if ($jo) 0 0 0
153 {
154 0 ▶ if ((ref($jo) eq 'HASH') && exists($jo->{date_declaration}) && exists($jo->{date_publication}) && exists($jo->{number}) && exists ($jo->{page}))
Branch: 1 branch
BranchTrueFalseTotal
if (ref $jo eq 'HASH' and exists $jo->{'date_declaration'} and exists $jo->{'date_publication'} and exists $jo->{'number'} and exists $jo->{'page'}) { } 0 0 0
Condition0%0/12
ref $jo eq "HASH" and exists $jo->{"date_declaration"} and exists $jo->{"date_publication"} and exists $jo->{"number"} and exists $jo->{"page"}
!ll&&!rl&&r
000
ref $jo eq "HASH" and exists $jo->{"date_declaration"} and exists $jo->{"date_publication"} and exists $jo->{"number"}
!ll&&!rl&&r
000
ref $jo eq "HASH" and exists $jo->{"date_declaration"} and exists $jo->{"date_publication"}
!ll&&!rl&&r
000
ref $jo eq "HASH" and exists $jo->{"date_declaration"}
!ll&&!rl&&r
000
MC/DC0%0/5
ref $jo eq "HASH" and exists $jo->{"date_declaration"} and exists $jo->{"date_publication"} and exists $jo->{"number"} and exists $jo->{"page"}
ref $jo eq "HASH" exists $jo->{"date_declaration"} exists $jo->{"date_publication"} exists $jo->{"number"} exists $jo->{"page"}
Truth table0%0/6
A and B and C and D and E
A= ref $jo eq "HASH"B= exists $jo->{"date_declaration"}C= exists $jo->{"date_publication"}D= exists $jo->{"number"}E= exists $jo->{"page"}
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
155 {
156 0 ▶ push @errs,'jo' unless ($jo->{date_declaration}=~m!^[0-9]{2}/[0-9]{2}/[0-9]{4}$! || $jo->{date_declaration}=~m!^[0-9]{4}-[0-9]{2}-[0-9]{2}$!);
Branch: 1 branch
BranchTrueFalseTotal
unless $jo->{"date_declaration"} =~ m[^[0-9]{2}/[0-9]{2}/[0-9]{4}$] or $jo->{"date_declaration"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/ 0 0 0
Condition0%0/3
$jo->{"date_declaration"} =~ m[^[0-9]{2}/[0-9]{2}/[0-9]{4}$] or $jo->{"date_declaration"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$jo->{"date_declaration"} =~ m[^[0-9]{2}/[0-9]{2}/[0-9]{4}$] or $jo->{"date_declaration"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/
$jo->{"date_declaration"} =~ m[^[0-9]{2}/[0-9]{2}/[0-9]{4}$] $jo->{"date_declaration"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/
Truth table0%0/3
A or B
A= $jo->{"date_declaration"} =~ m[^[0-9]{2}/[0-9]{2}/[0-9]{4}$]B= $jo->{"date_declaration"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/
ABresult
1X1
011
000
157 0 ▶ push @errs,'jo' unless ($jo->{date_publication}=~m!^[0-9]{2}/[0-9]{2}/[0-9]{4}$! || $jo->{date_publication}=~m!^[0-9]{4}-[0-9]{2}-[0-9]{2}$!);
Branch: 1 branch
BranchTrueFalseTotal
unless $jo->{"date_publication"} =~ m[^[0-9]{2}/[0-9]{2}/[0-9]{4}$] or $jo->{"date_publication"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/ 0 0 0
Condition0%0/3
$jo->{"date_publication"} =~ m[^[0-9]{2}/[0-9]{2}/[0-9]{4}$] or $jo->{"date_publication"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$jo->{"date_publication"} =~ m[^[0-9]{2}/[0-9]{2}/[0-9]{4}$] or $jo->{"date_publication"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/
$jo->{"date_publication"} =~ m[^[0-9]{2}/[0-9]{2}/[0-9]{4}$] $jo->{"date_publication"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/
Truth table0%0/3
A or B
A= $jo->{"date_publication"} =~ m[^[0-9]{2}/[0-9]{2}/[0-9]{4}$]B= $jo->{"date_publication"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/
ABresult
1X1
011
000
158 0 ▶ push @errs,'jo' unless $jo->{number}=~m/^[1-9][0-9]*$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $jo->{"number"} =~ /^[1-9][0-9]*$/ 0 0 0
159 0 ▶ push @errs,'jo' unless $jo->{page}=~m/^[1-9][0-9]*$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $jo->{"page"} =~ /^[1-9][0-9]*$/ 0 0 0
160 } else
161 {
162 0 push @errs,'jo';
163 }
164 }
165  
166 0 ▶ push @errs,'vat' if ($self->vat() && !Net::DRI::Util::xml_is_token($self->vat()));
Branch: 1 branch
BranchTrueFalseTotal
if $self->vat and not Net::DRI::Util::xml_is_token($self->vat) 0 0 0
Condition0%0/3
$self->vat and not Net::DRI::Util::xml_is_token($self->vat)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->vat and not Net::DRI::Util::xml_is_token($self->vat)
$self->vat not Net::DRI::Util::xml_is_token($self->vat)
Truth table0%0/3
A and not(B)
A= $self->vatB= not Net::DRI::Util::xml_is_token($self->vat)
ABresult
0X0
100
111
167 0 ▶ push @errs,'trademark' if ($self->trademark() && $self->trademark()!~m/^[0-9]*[A-Za-z]*[0-9]+$/);
Branch: 1 branch
BranchTrueFalseTotal
if $self->trademark and not $self->trademark =~ /^[0-9]*[A-Za-z]*[0-9]+$/ 0 0 0
Condition0%0/3
$self->trademark and not $self->trademark =~ /^[0-9]*[A-Za-z]*[0-9]+$/
!ll&&!rl&&r
000
MC/DC0%0/2
$self->trademark and not $self->trademark =~ /^[0-9]*[A-Za-z]*[0-9]+$/
$self->trademark not $self->trademark =~ /^[0-9]*[A-Za-z]*[0-9]+$/
Truth table0%0/3
A and not(B)
A= $self->trademarkB= not $self->trademark =~ /^[0-9]*[A-Za-z]*[0-9]+$/
ABresult
0X0
100
111
168  
169 0 my $birth=$self->birth();
170 0 ▶ if ($birth)
Branch: 1 branch
BranchTrueFalseTotal
if ($birth) 0 0 0
171 {
172 0 ▶ if ((ref($birth) eq 'HASH') && exists($birth->{date}) && exists($birth->{place}))
Branch: 1 branch
BranchTrueFalseTotal
if (ref $birth eq 'HASH' and exists $birth->{'date'} and exists $birth->{'place'}) { } 0 0 0
Condition0%0/6
ref $birth eq "HASH" and exists $birth->{"date"} and exists $birth->{"place"}
!ll&&!rl&&r
000
ref $birth eq "HASH" and exists $birth->{"date"}
!ll&&!rl&&r
000
MC/DC0%0/3
ref $birth eq "HASH" and exists $birth->{"date"} and exists $birth->{"place"}
ref $birth eq "HASH" exists $birth->{"date"} exists $birth->{"place"}
Truth table0%0/4
A and B and C
A= ref $birth eq "HASH"B= exists $birth->{"date"}C= exists $birth->{"place"}
ABCresult
0XX0
10X0
1100
1111
173 {
174 0 ▶ push @errs,'birth' unless ((ref($birth->{date}) eq 'DateTime') || $birth->{date}=~m!^[0-9]{4}-[0-9]{2}-[0-9]{2}$! || $birth->{date}=~m!^[0-9]{2}/[0-9]{2}/[0-9]{4}$!);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $birth->{"date"} eq "DateTime" or $birth->{"date"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/ or $birth->{"date"} =~ m[^[0-9]{2}/[0-9]{2}/[0-9]{4}$] 0 0 0
Condition0%0/6
ref $birth->{"date"} eq "DateTime" or $birth->{"date"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/ or $birth->{"date"} =~ m[^[0-9]{2}/[0-9]{2}/[0-9]{4}$]
l!l&&r!l&&!r
000
ref $birth->{"date"} eq "DateTime" or $birth->{"date"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/
l!l&&r!l&&!r
000
MC/DC0%0/3
ref $birth->{"date"} eq "DateTime" or $birth->{"date"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/ or $birth->{"date"} =~ m[^[0-9]{2}/[0-9]{2}/[0-9]{4}$]
ref $birth->{"date"} eq "DateTime" $birth->{"date"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/ $birth->{"date"} =~ m[^[0-9]{2}/[0-9]{2}/[0-9]{4}$]
Truth table0%0/4
A or B or C
A= ref $birth->{"date"} eq "DateTime"B= $birth->{"date"} =~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/C= $birth->{"date"} =~ m[^[0-9]{2}/[0-9]{2}/[0-9]{4}$]
ABCresult
1XX1
01X1
0011
0000
175 0 ▶ push @errs,'birth' unless (($birth->{place}=~m/^[A-Za-z]{2}$/ && ! is_code_fr($birth->{place})) || ($birth->{place}=~m/^(?:[0-9]{5}|) *, *(.+)$/ && is_commune($1)));
Branch: 1 branch
BranchTrueFalseTotal
unless $birth->{"place"} =~ /^[A-Za-z]{2}$/ and not is_code_fr($birth->{"place"}) or $birth->{"place"} =~ /^(?:[0-9]{5}|) *, *(.+)$/ and is_commune($1) 0 0 0
Condition0%0/9
$birth->{"place"} =~ /^[A-Za-z]{2}$/ and not is_code_fr($birth->{"place"}) or $birth->{"place"} =~ /^(?:[0-9]{5}|) *, *(.+)$/ and is_commune($1)
l!l&&r!l&&!r
000
$birth->{"place"} =~ /^[A-Za-z]{2}$/ and not is_code_fr($birth->{"place"})
!ll&&!rl&&r
000
$birth->{"place"} =~ /^(?:[0-9]{5}|) *, *(.+)$/ and is_commune($1)
!ll&&!rl&&r
000
MC/DC0%0/4
$birth->{"place"} =~ /^[A-Za-z]{2}$/ and not is_code_fr($birth->{"place"}) or $birth->{"place"} =~ /^(?:[0-9]{5}|) *, *(.+)$/ and is_commune($1)
$birth->{"place"} =~ /^[A-Za-z]{2}$/ not is_code_fr($birth->{"place"}) $birth->{"place"} =~ /^(?:[0-9]{5}|) *, *(.+)$/ is_commune($1)
Truth table0%0/7
A and not(B) or C and D
A= $birth->{"place"} =~ /^[A-Za-z]{2}$/B= not is_code_fr($birth->{"place"})C= $birth->{"place"} =~ /^(?:[0-9]{5}|) *, *(.+)$/D= is_commune($1)
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
176 } else
177 {
178 0 push @errs,'birth';
179 }
180 }
181  
182 0 ▶ my $isccfr=$self->cc()? is_code_fr(uc($self->cc())) : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->cc ? : 0 0 0
183  
184 ## Not same checks as AFNIC, but we will translate to their format when needed, better to standardize on EPP
185 0 ▶ if ($self->voice())
Branch: 1 branch
BranchTrueFalseTotal
if ($self->voice) 0 0 0
186 {
187 0 ▶ push @errs,'voice' if $self->voice()!~m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/ 0 0 0
188 0 ▶ push @errs,'voice' if ($isccfr && $self->voice()!~m/^\+33\./);
Branch: 1 branch
BranchTrueFalseTotal
if $isccfr and not $self->voice =~ /^\+33\./ 0 0 0
Condition0%0/3
$isccfr and not $self->voice =~ /^\+33\./
!ll&&!rl&&r
000
MC/DC0%0/2
$isccfr and not $self->voice =~ /^\+33\./
$isccfr not $self->voice =~ /^\+33\./
Truth table0%0/3
A and not(B)
A= $isccfrB= not $self->voice =~ /^\+33\./
ABresult
0X0
100
111
189 }
190 0 ▶ if ($self->fax())
Branch: 1 branch
BranchTrueFalseTotal
if ($self->fax) 0 0 0
191 {
192 0 ▶ push @errs,'fax' if $self->fax()!~m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/ 0 0 0
193 0 ▶ push @errs,'fax' if ($isccfr && $self->fax()!~m/^\+33\./);
Branch: 1 branch
BranchTrueFalseTotal
if $isccfr and not $self->fax =~ /^\+33\./ 0 0 0
Condition0%0/3
$isccfr and not $self->fax =~ /^\+33\./
!ll&&!rl&&r
000
MC/DC0%0/2
$isccfr and not $self->fax =~ /^\+33\./
$isccfr not $self->fax =~ /^\+33\./
Truth table0%0/3
A and not(B)
A= $isccfrB= not $self->fax =~ /^\+33\./
ABresult
0X0
100
111
194 }
195 0 ▶ push @errs,'email' if ($self->email() && !Email::Valid->rfc822($self->email()));
Branch: 1 branch
BranchTrueFalseTotal
if $self->email and not "Email::Valid"->rfc822($self->email) 0 0 0
Condition0%0/3
$self->email and not "Email::Valid"->rfc822($self->email)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->email and not "Email::Valid"->rfc822($self->email)
$self->email not "Email::Valid"->rfc822($self->email)
Truth table0%0/3
A and not(B)
A= $self->emailB= not "Email::Valid"->rfc822($self->email)
ABresult
0X0
100
111
196  
197 ## Maintainer is not tied to contact
198  
199 0 ▶ push @errs,'disclose' if ($self->disclose() && $self->disclose()!~m/^[ONY]$/i);
Branch: 1 branch
BranchTrueFalseTotal
if $self->disclose and not $self->disclose =~ /^[ONY]$/i 0 0 0
Condition0%0/3
$self->disclose and not $self->disclose =~ /^[ONY]$/i
!ll&&!rl&&r
000
MC/DC0%0/2
$self->disclose and not $self->disclose =~ /^[ONY]$/i
$self->disclose not $self->disclose =~ /^[ONY]$/i
Truth table0%0/3
A and not(B)
A= $self->discloseB= not $self->disclose =~ /^[ONY]$/i
ABresult
0X0
100
111
200  
201 0 my $q=$self->qualification();
202 0 ▶ if (defined $q)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $q) 0 0 0
203 {
204 0 ▶ push @errs,'qualification' if ref $q ne 'HASH' || grep { ! /^(?:identification|reachable)$/ } keys %$q;
Branch: 1 branch
BranchTrueFalseTotal
if ref $q ne "HASH" or grep {not /^(?:identification|reachable)$/;} keys %$q 0 0 0
Condition0%0/3
ref $q ne "HASH" or grep {not /^(?:identification|reachable)$/;} keys %$q
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $q ne "HASH" or grep {not /^(?:identification|reachable)$/;} keys %$q
ref $q ne "HASH" grep {not /^(?:identification|reachable)$/;} keys %$q
Truth table0%0/3
A or B
A= ref $q ne "HASH"B= grep {not /^(?:identification|reachable)$/;} keys %$q
ABresult
1X1
011
000
205 }
206  
207 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
208 0 return 1; ## everything ok.
209 }
210  
211 sub validate_registrant
212 0 ▶{
Subroutine validate_registrant: not called CC=14 SCAR=53.5
Pod undocumented
213 0 my $self=shift;
214 0 my @errs;
215 0 my $rs=$self->street();
216 0 ▶ push @errs,'street' if ($rs && ((ref($rs) ne 'ARRAY') || (@$rs > 3) || (grep { ! is_adresse($_) } @$rs)));
Branch: 1 branch
BranchTrueFalseTotal
if $rs and ref $rs ne "ARRAY" || @$rs > 3 || grep({not is_adresse($_);} @$rs) 0 0 0
Condition0%0/9
$rs and ref $rs ne "ARRAY" || @$rs > 3 || grep({not is_adresse($_);} @$rs)
!ll&&!rl&&r
000
ref $rs ne "ARRAY" or @$rs > 3 or grep {not is_adresse($_);} @$rs
l!l&&r!l&&!r
000
ref $rs ne "ARRAY" or @$rs > 3
l!l&&r!l&&!r
000
MC/DC0%0/4
$rs and ref $rs ne "ARRAY" || @$rs > 3 || grep({not is_adresse($_);} @$rs)
$rs ref $rs ne "ARRAY" @$rs > 3 grep {not is_adresse($_);} @$rs
Truth table0%0/5
A and B or C or D
A= $rsB= ref $rs ne "ARRAY"C= @$rs > 3D= grep {not is_adresse($_);} @$rs
ABCDresult
0XXX0
10000
11XX1
101X1
10011
217 0 ▶ push @errs,'city' if ($self->city() && ! is_commune($self->city()));
Branch: 1 branch
BranchTrueFalseTotal
if $self->city and not is_commune($self->city) 0 0 0
Condition0%0/3
$self->city and not is_commune($self->city)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->city and not is_commune($self->city)
$self->city not is_commune($self->city)
Truth table0%0/3
A and not(B)
A= $self->cityB= not is_commune($self->city)
ABresult
0X0
100
111
218  
219 0 my $cc=$self->cc();
220 0 my $isccfr=0;
221 0 ▶ if ($cc)
Branch: 1 branch
BranchTrueFalseTotal
if ($cc) 0 0 0
222 {
223 0 ▶ push @errs,'cc' if !exists($Net::DRI::Util::CCA2{uc($cc)});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $Net::DRI::Util::CCA2{uc $cc} 0 0 0
224 0 $isccfr=is_code_fr(uc($cc));
225 }
226  
227 0 my $pc=$self->pc();
228 0 ▶ if ($pc)
Branch: 1 branch
BranchTrueFalseTotal
if ($pc) 0 0 0
229 {
230 0 ▶ if ($isccfr)
Branch: 1 branch
BranchTrueFalseTotal
if ($isccfr) { } 0 0 0
231 {
232 0 ▶ push @errs,'pc' unless $pc=~m/^[0-9]{5}$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $pc =~ /^[0-9]{5}$/ 0 0 0
233 } else
234 {
235 0 ▶ push @errs,'pc' unless $pc=~m/^[-0-9A-Za-z ]+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $pc =~ /^[-0-9A-Za-z ]+$/ 0 0 0
236 }
237 }
238  
239 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
240 0 return 1; ## everything ok.
241 }
242  
243 sub init
244 0 ▶{
Subroutine init: not called CC=4 SCAR=30.0
Pod undocumented
245 0 my ($self,$what,$ndr)=@_;
246 0 my $pn=$ndr->protocol()->name();
247 0 ▶ if ($what eq 'create' && $pn eq 'EPP')
Branch: 1 branch
BranchTrueFalseTotal
if ($what eq "create" and $pn eq "EPP") 0 0 0
Condition0%0/3
$what eq "create" and $pn eq "EPP"
!ll&&!rl&&r
000
MC/DC0%0/2
$what eq "create" and $pn eq "EPP"
$what eq "create" $pn eq "EPP"
Truth table0%0/3
A and B
A= $what eq "create"B= $pn eq "EPP"
ABresult
0X0
100
111
248 {
249 0 ▶ $self->srid('AUTO') unless defined($self->srid()); ## we can not choose the ID
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->srid 0 0 0
250 }
251 0 return;
252 }
253  
254 ####################################################################################################
255 1 1;
« DRI/Data/Contact/NO.pm ↑ Summary DRI/Data/Contact/AT.pm »