DRI/Data/Contact/AT.pm

filter: Statementstmt 28.0% 14 / 50 Branchbran 0.0% 0 / 46 Conditioncond 0.0% 0 / 84 MC/DCmcdc 0.0% 0 / 43 Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 2 totaltotal 7.7% 18 / 231 CC 53 SCAR 75.8
CC
53
Cov
8%
validate
2352.0
init
42.0
BEGIN
1.0
CRAP 1950.9
« DRI/Data/Contact/AFNIC.pm ↑ Summary DRI/Protocol/EPP/Extensions/NO/Contact.pm »
1 ## Domain Registry Interface, Handling of contact data for .AT
2 ## Contributed by Michael Braunoeder from NIC.AT <mib@nic.at>
3 ##
4 ## Copyright (c) 2006,2008-2011,2013 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
5 ##
6 ## This file is part of Net::DRI
7 ##
8 ## Net::DRI is free software; you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation; either version 2 of the License, or
11 ## (at your option) any later version.
12 ##
13 ## See the LICENSE file that comes with this distribution for more details.
14 #########################################################################################
15  
16 package Net::DRI::Data::Contact::AT;
17  
18 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 2 ▶use base qw/Net::DRI::Data::Contact/;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 2 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 2 __PACKAGE__->register_attributes(qw(type));
26  
27 =pod
28  
29 =head1 NAME
30  
31 Net::DRI::Data::Contact::AT - Handle .AT contact data for Net::DRI
32  
33 =head1 DESCRIPTION
34  
35 This subclass of Net::DRI::Data::Contact adds accessors and validation for
36 .AT specific data.
37  
38 =head1 METHODS
39  
40 The following accessors/mutators can be called in chain, as they all return the object itself.
41  
42 =head2 type()
43  
44 type of contact : privateperson, organisation or role (mandatory) ; the registry may also return unspecified
45  
46 =head1 SUPPORT
47  
48 For now, support questions should be sent to:
49  
50 E<lt>netdri@dotandco.comE<gt>
51  
52 Please also see the SUPPORT file in the distribution.
53  
54 =head1 SEE ALSO
55  
56 http://www.dotandco.com/services/software/Net-DRI/
57  
58 =head1 AUTHOR
59  
60 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
61  
62 =head1 COPYRIGHT
63  
64 Copyright (c) 2006,2008-2010,2013 Patrick Mevzek <netdri@dotandco.com>.
65 All rights reserved.
66  
67 This program is free software; you can redistribute it and/or modify
68 it under the terms of the GNU General Public License as published by
69 the Free Software Foundation; either version 2 of the License, or
70 (at your option) any later version.
71  
72 See the LICENSE file that comes with this distribution for more details.
73  
74 =cut
75  
76 ####################################################################################################
77  
78 sub validate
79 0 ▶{
Subroutine validate: not called CC=48 SCAR=77.6
Pod undocumented
80 0 my ($self,$change)=@_;
81 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
82 0 my @errs;
83  
84 0 ▶ if (!$change)
Branch: 1 branch
BranchTrueFalseTotal
unless ($change) 0 0 0
85 {
86 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('Invalid contact information: name/city/cc/email/auth/srid mandatory') unless (scalar(($self->name())[1]) && scalar(($self->city())[1]) && scalar(($self->cc())[1]) && $self->email() && $self->auth() && $self->srid());
Branch: 1 branch
BranchTrueFalseTotal
unless scalar(($self->name)[1]) and scalar(($self->city)[1]) and scalar(($self->cc)[1]) and $self->email and $self->auth and $self->srid 0 0 0
Condition0%0/13
scalar(($self->name)[1]) and scalar(($self->city)[1]) and scalar(($self->cc)[1]) and $self->email and $self->auth and $self->srid
!ll&&!rl&&r
000
scalar(($self->name)[1]) and scalar(($self->city)[1]) and scalar(($self->cc)[1]) and $self->email and $self->auth
!ll&&!rl&&r
000
scalar(($self->name)[1]) and scalar(($self->city)[1]) and scalar(($self->cc)[1]) and $self->email
!ll&&!rl&&r
000
scalar(($self->name)[1]) and scalar(($self->city)[1]) and scalar(($self->cc)[1])
!ll
00
scalar(($self->name)[1]) and scalar(($self->city)[1])
!ll
00
MC/DC0%0/4
scalar(($self->name)[1]) and scalar(($self->city)[1]) and scalar(($self->cc)[1]) and $self->email and $self->auth and $self->srid
scalar(($self->name)[1]) $self->email $self->auth $self->srid
Truth table0%0/5
A and B and C and D
A= scalar(($self->name)[1])B= $self->emailC= $self->authD= $self->srid
ABCDresult
0XXX0
10XX0
110X0
11100
11111
87  
88 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
89  
90 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('Invalid contact information: type mandatory') unless ($self->type());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->type 0 0 0
91 }
92  
93 0 ▶ push @errs,'srid' if ($self->srid() && $self->srid()!~m/^\w{1,80}-\w{1,8}$/ && $self->srid()!~m/^AUTO$/i); ## \w includes _ in Perl
Branch: 1 branch
BranchTrueFalseTotal
if $self->srid and not $self->srid =~ /^\w{1,80}-\w{1,8}$/ and not $self->srid =~ /^AUTO$/i 0 0 0
Condition0%0/6
$self->srid and not $self->srid =~ /^\w{1,80}-\w{1,8}$/ and not $self->srid =~ /^AUTO$/i
!ll&&!rl&&r
000
$self->srid and not $self->srid =~ /^\w{1,80}-\w{1,8}$/
!ll&&!rl&&r
000
MC/DC0%0/3
$self->srid and not $self->srid =~ /^\w{1,80}-\w{1,8}$/ and not $self->srid =~ /^AUTO$/i
$self->srid not $self->srid =~ /^\w{1,80}-\w{1,8}$/ not $self->srid =~ /^AUTO$/i
Truth table0%0/4
A and not(B) and not(C)
A= $self->sridB= not $self->srid =~ /^\w{1,80}-\w{1,8}$/C= not $self->srid =~ /^AUTO$/i
ABCresult
0XX0
10X0
1100
1111
94 0 ▶ push @errs,'name' if ($self->name() && !Net::DRI::Util::xml_is_normalizedstring(($self->name())[1],1,255));
Branch: 1 branch
BranchTrueFalseTotal
if $self->name and not Net::DRI::Util::xml_is_normalizedstring(($self->name)[1], 1, 255) 0 0 0
Condition0%0/3
$self->name and not Net::DRI::Util::xml_is_normalizedstring(($self->name)[1], 1, 255)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->name and not Net::DRI::Util::xml_is_normalizedstring(($self->name)[1], 1, 255)
$self->name not Net::DRI::Util::xml_is_normalizedstring(($self->name)[1], 1, 255)
Truth table0%0/3
A and not(B)
A= $self->nameB= not Net::DRI::Util::xml_is_normalizedstring(($self->name)[1], 1, 255)
ABresult
0X0
100
111
95 0 ▶ push @errs,'org' if ($self->org() && !Net::DRI::Util::xml_is_normalizedstring(($self->org())[1],undef,255));
Branch: 1 branch
BranchTrueFalseTotal
if $self->org and not Net::DRI::Util::xml_is_normalizedstring(($self->org)[1], undef, 255) 0 0 0
Condition0%0/3
$self->org and not Net::DRI::Util::xml_is_normalizedstring(($self->org)[1], undef, 255)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->org and not Net::DRI::Util::xml_is_normalizedstring(($self->org)[1], undef, 255)
$self->org not Net::DRI::Util::xml_is_normalizedstring(($self->org)[1], undef, 255)
Truth table0%0/3
A and not(B)
A= $self->orgB= not Net::DRI::Util::xml_is_normalizedstring(($self->org)[1], undef, 255)
ABresult
0X0
100
111
96  
97 0 my @rs=($self->street());
98 0 ▶ if ($rs[1])
Branch: 1 branch
BranchTrueFalseTotal
if ($rs[1]) 0 0 0
99 {
100 0 ▶ push @errs,'street' if ((ref($rs[1]) ne 'ARRAY') || (@{$rs[1]} > 3) || (grep { !Net::DRI::Util::xml_is_normalizedstring($_,undef,255) } @{$rs[1]}));
Branch: 1 branch
BranchTrueFalseTotal
if ref $rs[1] ne "ARRAY" or @{$rs[1];} > 3 or grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} @{$rs[1];} 0 0 0
Condition0%0/6
ref $rs[1] ne "ARRAY" or @{$rs[1];} > 3 or grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} @{$rs[1];}
l!l&&r!l&&!r
000
ref $rs[1] ne "ARRAY" or @{$rs[1];} > 3
l!l&&r!l&&!r
000
MC/DC0%0/3
ref $rs[1] ne "ARRAY" or @{$rs[1];} > 3 or grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} @{$rs[1];}
ref $rs[1] ne "ARRAY" @{$rs[1];} > 3 grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} @{$rs[1];}
Truth table0%0/4
A or B or C
A= ref $rs[1] ne "ARRAY"B= @{$rs[1];} > 3C= grep {not Net::DRI::Util::xml_is_normalizedstring($_, undef, 255);} @{$rs[1];}
ABCresult
1XX1
01X1
0011
0000
101 }
102  
103 0 ▶ push @errs,'city' if ($self->city() && !Net::DRI::Util::xml_is_normalizedstring(($self->city())[1],1,255));
Branch: 1 branch
BranchTrueFalseTotal
if $self->city and not Net::DRI::Util::xml_is_normalizedstring(($self->city)[1], 1, 255) 0 0 0
Condition0%0/3
$self->city and not Net::DRI::Util::xml_is_normalizedstring(($self->city)[1], 1, 255)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->city and not Net::DRI::Util::xml_is_normalizedstring(($self->city)[1], 1, 255)
$self->city not Net::DRI::Util::xml_is_normalizedstring(($self->city)[1], 1, 255)
Truth table0%0/3
A and not(B)
A= $self->cityB= not Net::DRI::Util::xml_is_normalizedstring(($self->city)[1], 1, 255)
ABresult
0X0
100
111
104 0 ▶ push @errs,'sp' if ($self->sp() && !Net::DRI::Util::xml_is_normalizedstring(($self->sp())[1],undef,255));
Branch: 1 branch
BranchTrueFalseTotal
if $self->sp and not Net::DRI::Util::xml_is_normalizedstring(($self->sp)[1], undef, 255) 0 0 0
Condition0%0/3
$self->sp and not Net::DRI::Util::xml_is_normalizedstring(($self->sp)[1], undef, 255)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->sp and not Net::DRI::Util::xml_is_normalizedstring(($self->sp)[1], undef, 255)
$self->sp not Net::DRI::Util::xml_is_normalizedstring(($self->sp)[1], undef, 255)
Truth table0%0/3
A and not(B)
A= $self->spB= not Net::DRI::Util::xml_is_normalizedstring(($self->sp)[1], undef, 255)
ABresult
0X0
100
111
105 0 ▶ push @errs,'pc' if ($self->pc() && !Net::DRI::Util::xml_is_token(($self->pc())[1],1,16));
Branch: 1 branch
BranchTrueFalseTotal
if $self->pc and not Net::DRI::Util::xml_is_token(($self->pc)[1], 1, 16) 0 0 0
Condition0%0/3
$self->pc and not Net::DRI::Util::xml_is_token(($self->pc)[1], 1, 16)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->pc and not Net::DRI::Util::xml_is_token(($self->pc)[1], 1, 16)
$self->pc not Net::DRI::Util::xml_is_token(($self->pc)[1], 1, 16)
Truth table0%0/3
A and not(B)
A= $self->pcB= not Net::DRI::Util::xml_is_token(($self->pc)[1], 1, 16)
ABresult
0X0
100
111
106 0 ▶ push @errs,'cc' if ($self->cc() && !Net::DRI::Util::xml_is_token(($self->cc())[1],2,2));
Branch: 1 branch
BranchTrueFalseTotal
if $self->cc and not Net::DRI::Util::xml_is_token(($self->cc)[1], 2, 2) 0 0 0
Condition0%0/3
$self->cc and not Net::DRI::Util::xml_is_token(($self->cc)[1], 2, 2)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->cc and not Net::DRI::Util::xml_is_token(($self->cc)[1], 2, 2)
$self->cc not Net::DRI::Util::xml_is_token(($self->cc)[1], 2, 2)
Truth table0%0/3
A and not(B)
A= $self->ccB= not Net::DRI::Util::xml_is_token(($self->cc)[1], 2, 2)
ABresult
0X0
100
111
107 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
108  
109 0 ▶ push @errs,'voice' if ($self->voice() && (!Net::DRI::Util::xml_is_token($self->voice(),undef,17) || $self->voice()!~m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/));
Branch: 1 branch
BranchTrueFalseTotal
if $self->voice and not Net::DRI::Util::xml_is_token($self->voice, undef, 17) && $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/ 0 0 0
Condition0%0/6
$self->voice and not Net::DRI::Util::xml_is_token($self->voice, undef, 17) && $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
!ll&&!rl&&r
000
Net::DRI::Util::xml_is_token($self->voice, undef, 17) && $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
!ll&&!rl&&r
000
MC/DC0%0/3
$self->voice and not Net::DRI::Util::xml_is_token($self->voice, undef, 17) && $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
$self->voice Net::DRI::Util::xml_is_token($self->voice, undef, 17) $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
Truth table0%0/4
A and not(B && C)
A= $self->voiceB= Net::DRI::Util::xml_is_token($self->voice, undef, 17)C= $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
ABCresult
0XX0
1110
10X1
1101
110 0 ▶ push @errs,'fax' if ($self->fax() && (!Net::DRI::Util::xml_is_token($self->fax(),undef,17) || $self->fax()!~m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/));
Branch: 1 branch
BranchTrueFalseTotal
if $self->fax and not Net::DRI::Util::xml_is_token($self->fax, undef, 17) && $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/ 0 0 0
Condition0%0/6
$self->fax and not Net::DRI::Util::xml_is_token($self->fax, undef, 17) && $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
!ll&&!rl&&r
000
Net::DRI::Util::xml_is_token($self->fax, undef, 17) && $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
!ll&&!rl&&r
000
MC/DC0%0/3
$self->fax and not Net::DRI::Util::xml_is_token($self->fax, undef, 17) && $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
$self->fax Net::DRI::Util::xml_is_token($self->fax, undef, 17) $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
Truth table0%0/4
A and not(B && C)
A= $self->faxB= Net::DRI::Util::xml_is_token($self->fax, undef, 17)C= $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
ABCresult
0XX0
1110
10X1
1101
111 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
112  
113 0 my $ra=$self->auth();
114 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
115  
116  
117 0 ▶ push @errs,'type' if ($self->type() && $self->type()!~m/^(?:privateperson|organisation|role)$/);
Branch: 1 branch
BranchTrueFalseTotal
if $self->type and not $self->type =~ /^(?:privateperson|organisation|role)$/ 0 0 0
Condition0%0/3
$self->type and not $self->type =~ /^(?:privateperson|organisation|role)$/
!ll&&!rl&&r
000
MC/DC0%0/2
$self->type and not $self->type =~ /^(?:privateperson|organisation|role)$/
$self->type not $self->type =~ /^(?:privateperson|organisation|role)$/
Truth table0%0/3
A and not(B)
A= $self->typeB= not $self->type =~ /^(?:privateperson|organisation|role)$/
ABresult
0X0
100
111
118  
119 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
120  
121 0 return 1; ## everything ok.
122 }
123  
124 sub init
125 0 ▶{
Subroutine init: not called CC=6 SCAR=37.4
Pod undocumented
126 0 my ($self,$what,$ndr)=@_;
127  
128 0 ▶ if ($what eq 'create')
Branch: 1 branch
BranchTrueFalseTotal
if ($what eq "create") 0 0 0
129 {
130 0 my $a=$self->auth();
131 0 ▶ $self->auth({pw=>''}) unless ($a && (ref($a) eq 'HASH') && exists($a->{pw})); ## Mandatory in EPP, not used by .AT
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
132 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
133 }
134 0 return;
135 }
136  
137 ####################################################################################################
138 2 1;
« DRI/Data/Contact/AFNIC.pm ↑ Summary DRI/Protocol/EPP/Extensions/NO/Contact.pm »