DRI/Data/Contact/OpenSRS.pm

filter: Statementstmt 53.8% 14 / 26 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 17 MC/DCmcdc 0.0% 0 / 9 Subroutinesub 66.6% 4 / 6 Podpod 50.0% 1 / 2 totaltotal 27.9% 19 / 68 CC 11 SCAR 45.1
CC
11
Cov
27%
validate
132.0
lastname
2.0
BEGIN
1.0
CRAP 91.1
« DRI/Protocol/EPP/Extensions/AERO/Contact.pm ↑ Summary DRI/Data/Contact/COOP.pm »
1 ## Domain Registry Interface, Handling of contact data for OpenSRS
2 ##
3 ## Copyright (c) 2009,2013 Richard Siddall <netdri@elirion.net>. 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::OpenSRS;
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  
24 1 __PACKAGE__->register_attributes(qw(firstname url));
25  
26 =pod
27  
28 =head1 NAME
29  
30 Net::DRI::Data::Contact::OpenSRS - Handle OpenSRS contact data for Net::DRI
31  
32 =head1 DESCRIPTION
33  
34 This subclass of Net::DRI::Data::Contact adds accessors and validation for
35 OpenSRS specific data.
36  
37 =head1 METHODS
38  
39 The following accessors/mutators can be called in chain, as they all return the object itself.
40  
41 =head2 firstname()
42  
43 Please note that for OpenSRS data, the name() must be only the lastname, hence this extra firstname() method
44  
45 =head2 lastname()
46  
47 Alias for name()
48  
49 =head1 SUPPORT
50  
51 For now, support questions should be sent to:
52  
53 E<lt>netdri@dotandco.comE<gt>
54  
55 Please also see the SUPPORT file in the distribution.
56  
57 =head1 SEE ALSO
58  
59 http://www.dotandco.com/services/software/Net-DRI/
60  
61 =head1 AUTHOR
62  
63 Richard Siddall, E<lt>netdri@elirion.net<gt>
64  
65 =head1 COPYRIGHT
66  
67 Copyright (c) 2009,2013 Richard Siddall <netdri@elirion.net>.
68 All rights reserved.
69  
70 This program is free software; you can redistribute it and/or modify
71 it under the terms of the GNU General Public License as published by
72 the Free Software Foundation; either version 2 of the License, or
73 (at your option) any later version.
74  
75 See the LICENSE file that comes with this distribution for more details.
76  
77 =cut
78  
79 ####################################################################################################
80  
81 sub validate
82 0 ▶{
Subroutine validate: not called CC=11 SCAR=48.8
Pod undocumented
83 0 my ($self,$change)=@_;
84 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
85 0 my @errs;
86  
87 0 $self->SUPER::validate($change); ## will trigger an Exception if problem
88  
89 0 ▶ push @errs,'firstname' if ($self->firstname() && grep { !Net::DRI::Util::xml_is_normalizedstring($_,1,255) } ($self->firstname()));
Branch: 1 branch
BranchTrueFalseTotal
if $self->firstname and grep {not Net::DRI::Util::xml_is_normalizedstring($_, 1, 255);} $self->firstname 0 0 0
Condition0%0/3
$self->firstname and grep {not Net::DRI::Util::xml_is_normalizedstring($_, 1, 255);} $self->firstname
!ll&&!rl&&r
000
MC/DC0%0/2
$self->firstname and grep {not Net::DRI::Util::xml_is_normalizedstring($_, 1, 255);} $self->firstname
$self->firstname grep {not Net::DRI::Util::xml_is_normalizedstring($_, 1, 255);} $self->firstname
Truth table0%0/3
A and B
A= $self->firstnameB= grep {not Net::DRI::Util::xml_is_normalizedstring($_, 1, 255);} $self->firstname
ABresult
0X0
100
111
90  
91 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,12}(?:x\d{1,4})?$/);
Branch: 1 branch
BranchTrueFalseTotal
if $self->voice and not Net::DRI::Util::xml_is_token($self->voice, undef, 17) and not $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,12}(?:x\d{1,4})?$/ 0 0 0
Condition0%0/6
$self->voice and not Net::DRI::Util::xml_is_token($self->voice, undef, 17) and not $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,12}(?:x\d{1,4})?$/
!ll&&!rl&&r
000
$self->voice and not Net::DRI::Util::xml_is_token($self->voice, undef, 17)
!ll&&!rl&&r
000
MC/DC0%0/3
$self->voice and not Net::DRI::Util::xml_is_token($self->voice, undef, 17) and not $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,12}(?:x\d{1,4})?$/
$self->voice not Net::DRI::Util::xml_is_token($self->voice, undef, 17) not $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,12}(?:x\d{1,4})?$/
Truth table0%0/4
A and not(B) and not(C)
A= $self->voiceB= not Net::DRI::Util::xml_is_token($self->voice, undef, 17)C= not $self->voice =~ /^\+[0-9]{1,3}\.[0-9]{1,12}(?:x\d{1,4})?$/
ABCresult
0XX0
10X0
1100
1111
92 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,12}(?:x\d{1,4})?$/);
Branch: 1 branch
BranchTrueFalseTotal
if $self->fax and not Net::DRI::Util::xml_is_token($self->fax, undef, 17) and not $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,12}(?:x\d{1,4})?$/ 0 0 0
Condition0%0/6
$self->fax and not Net::DRI::Util::xml_is_token($self->fax, undef, 17) and not $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,12}(?:x\d{1,4})?$/
!ll&&!rl&&r
000
$self->fax and not Net::DRI::Util::xml_is_token($self->fax, undef, 17)
!ll&&!rl&&r
000
MC/DC0%0/3
$self->fax and not Net::DRI::Util::xml_is_token($self->fax, undef, 17) and not $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,12}(?:x\d{1,4})?$/
$self->fax not Net::DRI::Util::xml_is_token($self->fax, undef, 17) not $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,12}(?:x\d{1,4})?$/
Truth table0%0/4
A and not(B) and not(C)
A= $self->faxB= not Net::DRI::Util::xml_is_token($self->fax, undef, 17)C= not $self->fax =~ /^\+[0-9]{1,3}\.[0-9]{1,12}(?:x\d{1,4})?$/
ABCresult
0XX0
10X0
1100
1111
93  
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 0 return 1; ## everything ok.
96 }
97  
98 0 ▶sub lastname {
Subroutine lastname: not called CC=1 SCAR=6.9
Pod documented
99 0 my ($self, $change) = @_;
100 0 return $self->name($change);
101 }
102  
103 ####################################################################################################
104 1 1;
« DRI/Protocol/EPP/Extensions/AERO/Contact.pm ↑ Summary DRI/Data/Contact/COOP.pm »