DRI/Data/Contact/Nominet.pm

filter: Statementstmt 57.1% 20 / 35 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 23 MC/DCmcdc 0.0% 0 / 14 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 1 totaltotal 26.5% 26 / 98 CC 18 SCAR 55.5
CC
18
Cov
26%
validate
342.0
BEGIN
1.0
BEGIN
1.0
CRAP 256.8
« DRI/Protocol/EPP/Extensions/CoCCA/IPVerification.pm ↑ Summary DRI/Protocol/EPP/Extensions/VeriSign/JobsContact.pm »
1 ## Domain Registry Interface, Handling of contact data for Nominet (.UK)
2 ##
3 ## Copyright (c) 2008,2013 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
4 ## (c) 2013 Michael Holloway <michael@thedarkwinter.com>. All rights reserved.
5 ##
6 ## This file is part of Net::DRI
7 ##
8 ## Net::DRI is free software; you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation; either version 2 of the License, or
11 ## (at your option) any later version.
12 ##
13 ## See the LICENSE file that comes with this distribution for more details.
14 #########################################################################################
15  
16 package Net::DRI::Data::Contact::Nominet;
17  
18 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use base qw(Net::DRI::Data::Contact);
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Email::Valid;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 1 __PACKAGE__->register_attributes(qw(type co_no opt_out trad_name));
27  
28 =pod
29  
30 =head1 NAME
31  
32 Net::DRI::Data::Contact::Nominet - Handle .UK contact data for Net::DRI
33  
34 =head1 DESCRIPTION
35  
36 Please refer to Net::DRI::Data::Contact for core methods
37 and http://www.nominet.org.uk/registrars/systems/data/fields/ for registry extra data
38  
39 =head1 METHODS
40  
41 =head2 type()
42  
43 (registrant contact only) describes what type of organisation the domain name has been registered for ;
44 see http://www.nominet.org.uk/registrars/systems/data/regtype/
45  
46 =head2 co_no()
47  
48 (registrant contact only) registered number of the company or organisation
49  
50 =head2 opt_out()
51  
52 (registrant contact only) do not display address details in whois if yes (Y)
53  
54 =head1 SUPPORT
55  
56 For now, support questions should be sent to:
57  
58 E<lt>netdri@dotandco.comE<gt>
59  
60 Please also see the SUPPORT file in the distribution.
61  
62 =head1 SEE ALSO
63  
64 http://www.dotandco.com/services/software/Net-DRI/
65  
66 =head1 AUTHOR
67  
68 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
69  
70 =head1 COPYRIGHT
71  
72 Copyright (c) 2008,2013 Patrick Mevzek <netdri@dotandco.com>.
73 (c) 2013 Michael Holloway <michael@thedarkwinter.com>.
74 All rights reserved.
75  
76 This program is free software; you can redistribute it and/or modify
77 it under the terms of the GNU General Public License as published by
78 the Free Software Foundation; either version 2 of the License, or
79 (at your option) any later version.
80  
81 See the LICENSE file that comes with this distribution for more details.
82  
83 =cut
84  
85 ####################################################################################################
86  
87 sub validate
88 0 ▶{
Subroutine validate: not called CC=18 SCAR=58.3
Pod undocumented
89 0 my ($self,$change)=@_;
90 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
91 0 my @errs;
92  
93 0 $self->auth({'pw' => ''});
94 0 $self->SUPER::validate($change);
95  
96 0 ▶ if (!$change)
Branch: 1 branch
BranchTrueFalseTotal
unless ($change) 0 0 0
97 {
98 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('Invalid contact information: name mandatory') unless ($self->name());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->name 0 0 0
99 }
100  
101 ## See http://www.nominet.org.uk/registrars/systems/data/regtype/
102 0 ▶ push @errs,'type' if (defined($self->type()) && $self->type()!~m/^(?:LTD|PLC|IND|FIND|RCHAR|SCH|LLP|STRA|PTNR|GOV|CRC|STAT|FCORP|IP|FOTHER|OTHER|UNKNOWN)$/);
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->type and not $self->type =~ /^(?:LTD|PLC|IND|FIND|RCHAR|SCH|LLP|STRA|PTNR|GOV|CRC|STAT|FCORP|IP|FOTHER|OTHER|UNKNOWN)$/ 0 0 0
Condition0%0/3
defined $self->type and not $self->type =~ /^(?:LTD|PLC|IND|FIND|RCHAR|SCH|LLP|STRA|PTNR|GOV|CRC|STAT|FCORP|IP|FOTHER|OTHER|UNKNOWN)$/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->type and not $self->type =~ /^(?:LTD|PLC|IND|FIND|RCHAR|SCH|LLP|STRA|PTNR|GOV|CRC|STAT|FCORP|IP|FOTHER|OTHER|UNKNOWN)$/
defined $self->type not $self->type =~ /^(?:LTD|PLC|IND|FIND|RCHAR|SCH|LLP|STRA|PTNR|GOV|CRC|STAT|FCORP|IP|FOTHER|OTHER|UNKNOWN)$/
Truth table0%0/3
A and not(B)
A= defined $self->typeB= not $self->type =~ /^(?:LTD|PLC|IND|FIND|RCHAR|SCH|LLP|STRA|PTNR|GOV|CRC|STAT|FCORP|IP|FOTHER|OTHER|UNKNOWN)$/
ABresult
0X0
100
111
103 0 ▶ push @errs,'co_no' if (defined($self->co_no()) && !Net::DRI::Util::xml_is_token($self->co_no(),undef,255));
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->co_no and not Net::DRI::Util::xml_is_token($self->co_no, undef, 255) 0 0 0
Condition0%0/3
defined $self->co_no and not Net::DRI::Util::xml_is_token($self->co_no, undef, 255)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->co_no and not Net::DRI::Util::xml_is_token($self->co_no, undef, 255)
defined $self->co_no not Net::DRI::Util::xml_is_token($self->co_no, undef, 255)
Truth table0%0/3
A and not(B)
A= defined $self->co_noB= not Net::DRI::Util::xml_is_token($self->co_no, undef, 255)
ABresult
0X0
100
111
104 ## TO FIX : co_no is mandatory for registrations in .net, .ltd and .plc SLDs
105 0 ▶ push @errs,'opt_out' if (defined($self->opt_out()) && $self->opt_out()!~m/^[YN]$/i);
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->opt_out and not $self->opt_out =~ /^[YN]$/i 0 0 0
Condition0%0/3
defined $self->opt_out and not $self->opt_out =~ /^[YN]$/i
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->opt_out and not $self->opt_out =~ /^[YN]$/i
defined $self->opt_out not $self->opt_out =~ /^[YN]$/i
Truth table0%0/3
A and not(B)
A= defined $self->opt_outB= not $self->opt_out =~ /^[YN]$/i
ABresult
0X0
100
111
106 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
107  
108 0 ▶ if (defined($self->type()) && defined($self->opt_out()))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->type and defined $self->opt_out) 0 0 0
Condition0%0/3
defined $self->type and defined $self->opt_out
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->type and defined $self->opt_out
defined $self->type defined $self->opt_out
Truth table0%0/3
A and B
A= defined $self->typeB= defined $self->opt_out
ABresult
0X0
100
111
109 {
110 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('opt_out must be N if type is not IND or FIND') if ($self->type()!~m/^(?:IND|FIND)$/ && lc($self->opt_out()) ne 'n');
Branch: 1 branch
BranchTrueFalseTotal
if not $self->type =~ /^(?:IND|FIND)$/ and lc $self->opt_out ne "n" 0 0 0
Condition0%0/3
not $self->type =~ /^(?:IND|FIND)$/ and lc $self->opt_out ne "n"
!ll&&!rl&&r
000
MC/DC0%0/2
not $self->type =~ /^(?:IND|FIND)$/ and lc $self->opt_out ne "n"
not $self->type =~ /^(?:IND|FIND)$/ lc $self->opt_out ne "n"
Truth table0%0/3
not(A) and B
A= not $self->type =~ /^(?:IND|FIND)$/B= lc $self->opt_out ne "n"
ABresult
0X0
100
111
111 }
112 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('co_no must be defined if type is SCH') if (defined($self->type()) && $self->type() eq 'SCH' && !defined($self->co_no()));
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->type and $self->type eq "SCH" and not defined $self->co_no 0 0 0
Condition0%0/6
defined $self->type and $self->type eq "SCH" and not defined $self->co_no
!ll&&!rl&&r
000
defined $self->type and $self->type eq "SCH"
!ll&&!rl&&r
000
MC/DC0%0/3
defined $self->type and $self->type eq "SCH" and not defined $self->co_no
defined $self->type $self->type eq "SCH" not defined $self->co_no
Truth table0%0/4
A and B and not(C)
A= defined $self->typeB= $self->type eq "SCH"C= not defined $self->co_no
ABCresult
0XX0
10X0
1100
1111
113  
114 0 return 1; ## everything ok.
115 }
116  
117 ####################################################################################################
118 1 1;
« DRI/Protocol/EPP/Extensions/CoCCA/IPVerification.pm ↑ Summary DRI/Protocol/EPP/Extensions/VeriSign/JobsContact.pm »