DRI/Data/Contact/ARNES.pm

filter: Statementstmt 45.8% 11 / 24 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 2 totaltotal 24.1% 14 / 58 CC 10 SCAR 33.6
CC
10
Cov
24%
init
42.0
validate
30.0
BEGIN
1.0
CRAP 28.9
« DRI/Protocol/EPP/Extensions/DomainVerification.pm ↑ Summary DRI/Protocol/RRI/Session.pm »
1 ## Domain Registry Interface, Handling of contact data for .SI
2 ##
3 ## Copyright (c) 2008,2009,2013,2016 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::ARNES;
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 __PACKAGE__->register_attributes(qw(ctype));
23  
24 =pod
25  
26 =head1 NAME
27  
28 Net::DRI::Data::Contact::ARNES - Handle .SI contact data for Net::DRI
29  
30 =head1 DESCRIPTION
31  
32 This subclass of Net::DRI::Data::Contact adds accessors and validation for
33 .SI specific data.
34  
35 =head1 METHODS
36  
37 The following accessors/mutators can be called in chain, as they all return the object itself.
38  
39 =head2 ctype()
40  
41 stores type of the contact object which can be 'person' for private persons or 'org' for organizations
42  
43 =head1 SUPPORT
44  
45 For now, support questions should be sent to:
46  
47 E<lt>netdri@dotandco.comE<gt>
48  
49 Please also see the SUPPORT file in the distribution.
50  
51 =head1 SEE ALSO
52  
53 http://www.dotandco.com/services/software/Net-DRI/
54  
55 =head1 AUTHOR
56  
57 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
58  
59 =head1 COPYRIGHT
60  
61 Copyright (c) 2008,2009,2013,2016 Patrick Mevzek <netdri@dotandco.com>.
62 All rights reserved.
63  
64 This program is free software; you can redistribute it and/or modify
65 it under the terms of the GNU General Public License as published by
66 the Free Software Foundation; either version 2 of the License, or
67 (at your option) any later version.
68  
69 See the LICENSE file that comes with this distribution for more details.
70  
71 =cut
72  
73 ####################################################################################################
74  
75 sub validate
76 {
77 0 ▶ my ($self,$change)=@_;
Subroutine validate: not called CC=5 SCAR=34.0
Pod undocumented
78 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
79 0 my @errs;
80  
81 0 $self->SUPER::validate($change); ## will trigger an Exception if problem
82  
83 0 ▶ push @errs,'ctype' if ($self->ctype() && $self->ctype()!~m/^(person|org)$/);
Branch: 1 branch
BranchTrueFalseTotal
if $self->ctype and not $self->ctype =~ /^(person|org)$/ 0 0 0
Condition0%0/3
$self->ctype and not $self->ctype =~ /^(person|org)$/
!ll&&!rl&&r
000
MC/DC0%0/2
$self->ctype and not $self->ctype =~ /^(person|org)$/
$self->ctype not $self->ctype =~ /^(person|org)$/
Truth table0%0/3
A and not(B)
A= $self->ctypeB= not $self->ctype =~ /^(person|org)$/
ABresult
0X0
100
111
84  
85 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
86  
87 0 return 1; ## everything ok.
88 }
89  
90 sub init
91 {
92 0 ▶ my ($self,$what,$ndr)=@_;
Subroutine init: not called CC=6 SCAR=37.4
Pod undocumented
93  
94 0 ▶ if ($what eq 'create')
Branch: 1 branch
BranchTrueFalseTotal
if ($what eq "create") 0 0 0
95 {
96 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
97 0 my $a=$self->auth();
98 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
99 }
100 0 return;
101 }
102  
103 ####################################################################################################
104 1 1;
« DRI/Protocol/EPP/Extensions/DomainVerification.pm ↑ Summary DRI/Protocol/RRI/Session.pm »