DRI/Data/Contact/CIRA.pm

filter: Statementstmt 41.4% 17 / 41 Branchbran 0.0% 0 / 26 Conditioncond 0.0% 0 / 47 MC/DCmcdc 0.0% 0 / 23 Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 2 totaltotal 15.0% 22 / 146 CC 30 SCAR 62.4
CC
30
Cov
15%
validate
702.0
init
30.0
BEGIN
1.0
CRAP 511.3
« DRI/Protocol/EPP/Core/RegistryMessage.pm ↑ Summary DRI/Protocol/EPP/Extensions/TCI/Registrar.pm »
1 ## Domain Registry Interface, Handling of contact data for CIRA
2 ##
3 ## Copyright (c) 2010,2013,2019 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::CIRA;
16  
17 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use base qw/Net::DRI::Data::Contact/;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 1 __PACKAGE__->register_attributes(qw(legal_form lang agreement whois_display));
26  
27 ####################################################################################################
28  
29 sub validate
30 0 ▶{
Subroutine validate: not called CC=26 SCAR=65.5
Pod undocumented
31 0 my ($self,$change)=@_;
32 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
33  
34 0 $self->SUPER::validate(1); ## will trigger an Exception if problem
35  
36 0 my @errs;
37 0 ▶ if (!$change)
Branch: 1 branch
BranchTrueFalseTotal
unless ($change) 0 0 0
38 {
39 0 ▶ my @missing=grep { my $r=scalar $self->$_(); (defined $r && length $r)? 0 : 1 } qw/name cc lang srid auth/;
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
40 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('Mandatory contact information missing: '.join('/',@missing)) if @missing;
Branch: 1 branch
BranchTrueFalseTotal
if @missing 0 0 0
41 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
42 }
43  
44 0 ▶ push @errs,'sp' if (defined $self->sp() && defined $self->cc() && $self->cc() eq 'CA' && $self->sp()!~m/^(?:AB|BC|MB|NB|NL|NT|NS|NU|ON|PE|QC|SK|YT)$/);
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->sp and defined $self->cc and $self->cc eq "CA" and not $self->sp =~ /^(?:AB|BC|MB|NB|NL|NT|NS|NU|ON|PE|QC|SK|YT)$/ 0 0 0
Condition0%0/9
defined $self->sp and defined $self->cc and $self->cc eq "CA" and not $self->sp =~ /^(?:AB|BC|MB|NB|NL|NT|NS|NU|ON|PE|QC|SK|YT)$/
!ll&&!rl&&r
000
defined $self->sp and defined $self->cc and $self->cc eq "CA"
!ll&&!rl&&r
000
defined $self->sp and defined $self->cc
!ll&&!rl&&r
000
MC/DC0%0/4
defined $self->sp and defined $self->cc and $self->cc eq "CA" and not $self->sp =~ /^(?:AB|BC|MB|NB|NL|NT|NS|NU|ON|PE|QC|SK|YT)$/
defined $self->sp defined $self->cc $self->cc eq "CA" not $self->sp =~ /^(?:AB|BC|MB|NB|NL|NT|NS|NU|ON|PE|QC|SK|YT)$/
Truth table0%0/5
A and B and C and not(D)
A= defined $self->spB= defined $self->ccC= $self->cc eq "CA"D= not $self->sp =~ /^(?:AB|BC|MB|NB|NL|NT|NS|NU|ON|PE|QC|SK|YT)$/
ABCDresult
0XXX0
10XX0
110X0
11100
11111
45  
46 0 ▶ push @errs,'legal_form' if (defined $self->legal_form() && $self->legal_form()!~m!^(?:CCO|CCT|RES|GOV|EDU|ASS|HOP|PRT|TDM|TRD|PLT|LAM|TRS|ABO|INB|LGR|OMK|MAJ)$!);
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->legal_form and not $self->legal_form =~ /^(?:CCO|CCT|RES|GOV|EDU|ASS|HOP|PRT|TDM|TRD|PLT|LAM|TRS|ABO|INB|LGR|OMK|MAJ)$/ 0 0 0
Condition0%0/3
defined $self->legal_form and not $self->legal_form =~ /^(?:CCO|CCT|RES|GOV|EDU|ASS|HOP|PRT|TDM|TRD|PLT|LAM|TRS|ABO|INB|LGR|OMK|MAJ)$/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->legal_form and not $self->legal_form =~ /^(?:CCO|CCT|RES|GOV|EDU|ASS|HOP|PRT|TDM|TRD|PLT|LAM|TRS|ABO|INB|LGR|OMK|MAJ)$/
defined $self->legal_form not $self->legal_form =~ /^(?:CCO|CCT|RES|GOV|EDU|ASS|HOP|PRT|TDM|TRD|PLT|LAM|TRS|ABO|INB|LGR|OMK|MAJ)$/
Truth table0%0/3
A and not(B)
A= defined $self->legal_formB= not $self->legal_form =~ /^(?:CCO|CCT|RES|GOV|EDU|ASS|HOP|PRT|TDM|TRD|PLT|LAM|TRS|ABO|INB|LGR|OMK|MAJ)$/
ABresult
0X0
100
111
47 0 ▶ push @errs,'lang' if (defined $self->lang() && $self->lang()!~m/^(?:fr|en)$/o);
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->lang and not $self->lang =~ /^(?:fr|en)$/o 0 0 0
Condition0%0/3
defined $self->lang and not $self->lang =~ /^(?:fr|en)$/o
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->lang and not $self->lang =~ /^(?:fr|en)$/o
defined $self->lang not $self->lang =~ /^(?:fr|en)$/o
Truth table0%0/3
A and not(B)
A= defined $self->langB= not $self->lang =~ /^(?:fr|en)$/o
ABresult
0X0
100
111
48 0 ▶ if (defined $self->agreement())
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->agreement) 0 0 0
49 {
50 0 my $ra=$self->agreement();
51 0 ▶ push @errs,'agreement' if (ref($ra) ne 'HASH' || 2!=keys(%$ra) || !exists($ra->{version}) || !exists($ra->{signed}) || (length($ra->{version}) > 4 and ''.$ra->{version} ne 'default') || $ra->{signed}!~m/^(?:0|1)$/);
Branch: 1 branch
BranchTrueFalseTotal
if ref $ra ne "HASH" or 2 != keys %$ra or not exists $ra->{"version"} or not exists $ra->{"signed"} or length $ra->{"version"} > 4 and '' . $ra->{"version"} ne "default" or not $ra->{"signed"} =~ /^(?:0|1)$/ 0 0 0
Condition0%0/18
ref $ra ne "HASH" or 2 != keys %$ra or not exists $ra->{"version"} or not exists $ra->{"signed"} or length $ra->{"version"} > 4 and '' . $ra->{"version"} ne "default" or not $ra->{"signed"} =~ /^(?:0|1)$/
l!l&&r!l&&!r
000
ref $ra ne "HASH" or 2 != keys %$ra or not exists $ra->{"version"} or not exists $ra->{"signed"} or length $ra->{"version"} > 4 and '' . $ra->{"version"} ne "default"
l!l&&r!l&&!r
000
ref $ra ne "HASH" or 2 != keys %$ra or not exists $ra->{"version"} or not exists $ra->{"signed"}
l!l&&r!l&&!r
000
ref $ra ne "HASH" or 2 != keys %$ra or not exists $ra->{"version"}
l!l&&r!l&&!r
000
ref $ra ne "HASH" or 2 != keys %$ra
l!l&&r!l&&!r
000
length $ra->{"version"} > 4 and '' . $ra->{"version"} ne "default"
!ll&&!rl&&r
000
MC/DC0%0/7
ref $ra ne "HASH" or 2 != keys %$ra or not exists $ra->{"version"} or not exists $ra->{"signed"} or length $ra->{"version"} > 4 and '' . $ra->{"version"} ne "default" or not $ra->{"signed"} =~ /^(?:0|1)$/
ref $ra ne "HASH" 2 != keys %$ra not exists $ra->{"version"} not exists $ra->{"signed"} length $ra->{"version"} > 4 '' . $ra->{"version"} ne "default" not $ra->{"signed"} =~ /^(?:0|1)$/
Truth table0%0/9
A or B or not(C) or not(D) or E and F or not(G)
A= ref $ra ne "HASH"B= 2 != keys %$raC= not exists $ra->{"version"}D= not exists $ra->{"signed"}E= length $ra->{"version"} > 4F= '' . $ra->{"version"} ne "default"G= not $ra->{"signed"} =~ /^(?:0|1)$/
ABCDEFGresult
1XXXXXX1
01XXXXX1
001XXXX1
0001XXX1
000011X1
00000X11
00001011
00000X00
00001000
52 }
53 0 ▶ push @errs,'whois_display' if (defined $self->whois_display() && $self->whois_display()!~m/^(?:FULL|PRIVATE)$/o);
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->whois_display and not $self->whois_display =~ /^(?:FULL|PRIVATE)$/o 0 0 0
Condition0%0/3
defined $self->whois_display and not $self->whois_display =~ /^(?:FULL|PRIVATE)$/o
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->whois_display and not $self->whois_display =~ /^(?:FULL|PRIVATE)$/o
defined $self->whois_display not $self->whois_display =~ /^(?:FULL|PRIVATE)$/o
Truth table0%0/3
A and not(B)
A= defined $self->whois_displayB= not $self->whois_display =~ /^(?:FULL|PRIVATE)$/o
ABresult
0X0
100
111
54  
55 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
56 0 return 1; ## everything ok.
57 }
58  
59 sub init
60 0 ▶{
Subroutine init: not called CC=5 SCAR=34.0
Pod undocumented
61 0 my ($self,$what,$ndr)=@_;
62 0 ▶ if ($what eq 'create')
Branch: 1 branch
BranchTrueFalseTotal
if ($what eq "create") 0 0 0
63 {
64 0 my $a=$self->auth();
65 0 ▶ $self->auth({pw=>''}) unless ($a && (ref($a) eq 'HASH') && exists($a->{pw})); ## authInfo is not used
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
66 }
67 0 return;
68 }
69  
70 ####################################################################################################
71 1 1;
72  
73 __END__
« DRI/Protocol/EPP/Core/RegistryMessage.pm ↑ Summary DRI/Protocol/EPP/Extensions/TCI/Registrar.pm »