DRI/Data/Contact/BR.pm

filter: Statementstmt 53.8% 14 / 26 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 2 totaltotal 34.6% 18 / 52 CC 8 SCAR 31.1
CC
8
Cov
34%
validate
42.0
init
12.0
BEGIN
1.0
CRAP 22.5
« DRI/Protocol/EPP/Extensions/EURid/Contact.pm ↑ Summary DRI/Protocol/EPP/Extensions/COZA/Contact.pm »
1 ## Domain Registry Interface, Handling of contact data for BR
2 ##
3 ## Copyright (c) 2008,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::BR;
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 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 __PACKAGE__->register_attributes(qw(orgid type associated_contacts associated_domains responsible proxy));
24  
25 =pod
26  
27 =head1 NAME
28  
29 Net::DRI::Data::Contact::BR - Handle BR contact data for Net::DRI
30  
31 =head1 DESCRIPTION
32  
33 This subclass of Net::DRI::Data::Contact adds accessors and validation for
34 BR specific data.
35  
36 =head1 METHODS
37  
38 The following mutators can be called in chain, as they all return the object itself.
39  
40 =head2 orgid()
41  
42 organization id
43  
44 =head2 type()
45  
46 type of contact (admin, billing or member)
47  
48 =head1 SUPPORT
49  
50 For now, support questions should be sent to:
51  
52 E<lt>netdri@dotandco.comE<gt>
53  
54 Please also see the SUPPORT file in the distribution.
55  
56 =head1 SEE ALSO
57  
58 http://www.dotandco.com/services/software/Net-DRI/
59  
60 =head1 AUTHOR
61  
62 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
63  
64 =head1 COPYRIGHT
65  
66 Copyright (c) 2008,2009,2013 Patrick Mevzek <netdri@dotandco.com>.
67 All rights reserved.
68  
69 This program is free software; you can redistribute it and/or modify
70 it under the terms of the GNU General Public License as published by
71 the Free Software Foundation; either version 2 of the License, or
72 (at your option) any later version.
73  
74 See the LICENSE file that comes with this distribution for more details.
75  
76 =cut
77  
78 ####################################################################################################
79  
80 sub validate
81 {
82 0 ▶ my ($self,$change)=@_;
Subroutine validate: not called CC=6 SCAR=37.4
Pod undocumented
83 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
84 0 my @errs;
85  
86 0 $self->SUPER::validate($change); ## will trigger an Exception if problem
87  
88 0 ▶ if (!$change)
Branch: 1 branch
BranchTrueFalseTotal
unless ($change) 0 0 0
89 {
90 ## Net::DRI::Exception::usererr_insufficient_parameters('orgid is mandatory') unless $self->orgid();
91 }
92  
93 0 ▶ push @errs,'orgid' if ($self->orgid() && !Net::DRI::Util::xml_is_token($self->orgid(),1,30));
Branch: 1 branch
BranchTrueFalseTotal
if $self->orgid and not Net::DRI::Util::xml_is_token($self->orgid, 1, 30) 0 0 0
Condition0%0/3
$self->orgid and not Net::DRI::Util::xml_is_token($self->orgid, 1, 30)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->orgid and not Net::DRI::Util::xml_is_token($self->orgid, 1, 30)
$self->orgid not Net::DRI::Util::xml_is_token($self->orgid, 1, 30)
Truth table0%0/3
A and not(B)
A= $self->orgidB= not Net::DRI::Util::xml_is_token($self->orgid, 1, 30)
ABresult
0X0
100
111
94  
95 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
96  
97 0 return 1; ## everything ok.
98 }
99  
100 sub init
101 {
102 0 ▶ my ($self,$what,$ndr)=@_;
Subroutine init: not called CC=3 SCAR=24.8
Pod undocumented
103  
104 0 ▶ if ($what eq 'create')
Branch: 1 branch
BranchTrueFalseTotal
if ($what eq "create") 0 0 0
105 {
106 0 ▶ $self->srid('auto') unless defined($self->srid()); ## we can not choose the ID for pure contacts (but we can for brorg creations it seems)
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->srid 0 0 0
107 }
108 0 return;
109 }
110  
111 ####################################################################################################
112 1 1;
« DRI/Protocol/EPP/Extensions/EURid/Contact.pm ↑ Summary DRI/Protocol/EPP/Extensions/COZA/Contact.pm »