DRI/Data/Contact/LU.pm

filter: Statementstmt 45.9% 17 / 37 Branchbran 0.0% 0 / 24 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 2 totaltotal 23.9% 22 / 92 CC 18 SCAR 48.6
CC
18
Cov
23%
validate
210.0
init
30.0
BEGIN
1.0
CRAP 129.0
« DRI/Data/Contact/US.pm ↑ Summary DRI/Protocol/EPP/Extensions/BR/Contact.pm »
1 ## Domain Registry Interface, Handling of contact data for LU
2 ##
3 ## Copyright (c) 2007-2009,2013 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::LU;
16  
17 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 2 ▶use base qw/Net::DRI::Data::Contact/;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 2 __PACKAGE__->register_attributes(qw(type));
25  
26 =pod
27  
28 =head1 NAME
29  
30 Net::DRI::Data::Contact::LU - Handle .LU contact data for Net::DRI
31  
32 =head1 DESCRIPTION
33  
34 This subclass of Net::DRI::Data::Contact adds accessors and validation for
35 .LU specific data.
36  
37 This registry uses only localized data with characters in US-ASCII and ISO-LATIN-1
38  
39 =head1 METHODS
40  
41 The following accessors/mutators can be called in chain, as they all return the object itself.
42  
43 =head2 type()
44  
45 type of contact : holder_org, holder_pers (for contact objects used as holders) or contact
46  
47 =head1 SUPPORT
48  
49 For now, support questions should be sent to:
50  
51 E<lt>netdri@dotandco.comE<gt>
52  
53 Please also see the SUPPORT file in the distribution.
54  
55 =head1 SEE ALSO
56  
57 http://www.dotandco.com/services/software/Net-DRI/
58  
59 =head1 AUTHOR
60  
61 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
62  
63 =head1 COPYRIGHT
64  
65 Copyright (c) 2007-2009,2013 Patrick Mevzek <netdri@dotandco.com>.
66 All rights reserved.
67  
68 This program is free software; you can redistribute it and/or modify
69 it under the terms of the GNU General Public License as published by
70 the Free Software Foundation; either version 2 of the License, or
71 (at your option) any later version.
72  
73 See the LICENSE file that comes with this distribution for more details.
74  
75 =cut
76  
77 ####################################################################################################
78  
79 sub validate
80 0 ▶{
Subroutine validate: not called CC=14 SCAR=53.5
Pod undocumented
81 0 my ($self,$change)=@_;
82 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
83 0 my @errs;
84  
85 0 $self->SUPER::validate($change); ## will trigger an Exception if problem
86  
87 0 ▶ if (!$change)
Branch: 1 branch
BranchTrueFalseTotal
unless ($change) 0 0 0
88 {
89 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('Invalid contact information: pc mandatory') unless (scalar($self->pc()));
Branch: 1 branch
BranchTrueFalseTotal
unless scalar $self->pc 0 0 0
90 }
91  
92 0 ▶ push @errs,'sp' if $self->sp(); ## not allowed
Branch: 1 branch
BranchTrueFalseTotal
if $self->sp 0 0 0
93 0 ▶ push @errs,'type' if ($self->type() && $self->type()!~m/^(?:holder_org|holder_pers|contact)/);
Branch: 1 branch
BranchTrueFalseTotal
if $self->type and not $self->type =~ /^(?:holder_org|holder_pers|contact)/ 0 0 0
Condition0%0/3
$self->type and not $self->type =~ /^(?:holder_org|holder_pers|contact)/
!ll&&!rl&&r
000
MC/DC0%0/2
$self->type and not $self->type =~ /^(?:holder_org|holder_pers|contact)/
$self->type not $self->type =~ /^(?:holder_org|holder_pers|contact)/
Truth table0%0/3
A and not(B)
A= $self->typeB= not $self->type =~ /^(?:holder_org|holder_pers|contact)/
ABresult
0X0
100
111
94 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
95  
96 0 ▶ if ($self->type() && ($self->type() ne 'contact'))
Branch: 1 branch
BranchTrueFalseTotal
if ($self->type and $self->type ne "contact") 0 0 0
Condition0%0/3
$self->type and $self->type ne "contact"
!ll&&!rl&&r
000
MC/DC0%0/2
$self->type and $self->type ne "contact"
$self->type $self->type ne "contact"
Truth table0%0/3
A and B
A= $self->typeB= $self->type ne "contact"
ABresult
0X0
100
111
97 {
98 0 ▶ push @errs,'voice' if $self->voice();
Branch: 1 branch
BranchTrueFalseTotal
if $self->voice 0 0 0
99 0 ▶ push @errs,'fax' if $self->fax();
Branch: 1 branch
BranchTrueFalseTotal
if $self->fax 0 0 0
100 0 ▶ push @errs,'org' if $self->org();
Branch: 1 branch
BranchTrueFalseTotal
if $self->org 0 0 0
101 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information (not allowed for holders): '.join('/',@errs)) if @errs;
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
102 }
103  
104 0 return 1; ## everything ok.
105 }
106  
107 sub init
108 0 ▶{
Subroutine init: not called CC=5 SCAR=34.0
Pod undocumented
109 0 my ($self,$what,$ndr)=@_;
110  
111 0 ▶ if ($what eq 'create')
Branch: 1 branch
BranchTrueFalseTotal
if ($what eq "create") 0 0 0
112 {
113 0 my $a=$self->auth();
114 0 ▶ $self->auth({pw=>''}) 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
115 }
116 0 return;
117 }
118  
119 ####################################################################################################
120 2 1;
« DRI/Data/Contact/US.pm ↑ Summary DRI/Protocol/EPP/Extensions/BR/Contact.pm »