DRI/Data/Contact/CAT.pm

filter: Statementstmt 66.6% 20 / 30 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 17 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 1 totaltotal 34.6% 26 / 75 CC 12 SCAR 46.5
CC
12
Cov
35%
validate
156.0
BEGIN
1.0
BEGIN
1.0
CRAP 104.3
« DRI/Protocol/EPP/Extensions/EURid/Registrar.pm ↑ Summary DRI/Protocol/OpenSRS/XCP/Message.pm »
1 ## Domain Registry Interface, Handling of contact data for .CAT
2 ##
3 ## Copyright (c) 2006,2008,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::CAT;
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 Email::Valid;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 2 __PACKAGE__->register_attributes(qw(lang email_sponsor maintainer));
26  
27 =pod
28  
29 =head1 NAME
30  
31 Net::DRI::Data::Contact::CAT - Handle .CAT contact data for Net::DRI
32  
33 =head1 DESCRIPTION
34  
35 This subclass of Net::DRI::Data::Contact adds accessors and validation for
36 .CAT specific data.
37  
38 .CAT uses only localized data.
39  
40 =head1 METHODS
41  
42 The following accessors/mutators can be called in chain, as they all return the object itself.
43  
44 =head2 lang()
45  
46 optional language of contact, according to RFC3066
47  
48 =head2 maintainer()
49  
50 optional free-form element that is published in whois
51  
52 =head2 email_sponsor()
53  
54 e-mail address to use when participating in the community sponsoring model of the puntCAT registry ;
55 may be identical to the primary e-mail address
56  
57 =head1 SUPPORT
58  
59 For now, support questions should be sent to:
60  
61 E<lt>netdri@dotandco.comE<gt>
62  
63 Please also see the SUPPORT file in the distribution.
64  
65 =head1 SEE ALSO
66  
67 http://www.dotandco.com/services/software/Net-DRI/
68  
69 =head1 AUTHOR
70  
71 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
72  
73 =head1 COPYRIGHT
74  
75 Copyright (c) 2006,2008,2013 Patrick Mevzek <netdri@dotandco.com>.
76 All rights reserved.
77  
78 This program is free software; you can redistribute it and/or modify
79 it under the terms of the GNU General Public License as published by
80 the Free Software Foundation; either version 2 of the License, or
81 (at your option) any later version.
82  
83 See the LICENSE file that comes with this distribution for more details.
84  
85 =cut
86  
87 ####################################################################################################
88  
89 sub validate
90 0 ▶{
Subroutine validate: not called CC=12 SCAR=50.5
Pod undocumented
91 0 my ($self,$change)=@_;
92 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
93 0 my @errs;
94  
95 0 $self->SUPER::validate($change); ## will trigger an Exception if problem
96  
97 0 ▶ push @errs,'lang' if ($self->lang() && !Net::DRI::Util::xml_is_language($self->lang()));
Branch: 1 branch
BranchTrueFalseTotal
if $self->lang and not Net::DRI::Util::xml_is_language($self->lang) 0 0 0
Condition0%0/3
$self->lang and not Net::DRI::Util::xml_is_language($self->lang)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->lang and not Net::DRI::Util::xml_is_language($self->lang)
$self->lang not Net::DRI::Util::xml_is_language($self->lang)
Truth table0%0/3
A and not(B)
A= $self->langB= not Net::DRI::Util::xml_is_language($self->lang)
ABresult
0X0
100
111
98 0 ▶ push @errs,'maintainer' if ($self->maintainer() && !Net::DRI::Util::xml_is_token($self->maintainer(),undef,128));
Branch: 1 branch
BranchTrueFalseTotal
if $self->maintainer and not Net::DRI::Util::xml_is_token($self->maintainer, undef, 128) 0 0 0
Condition0%0/3
$self->maintainer and not Net::DRI::Util::xml_is_token($self->maintainer, undef, 128)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->maintainer and not Net::DRI::Util::xml_is_token($self->maintainer, undef, 128)
$self->maintainer not Net::DRI::Util::xml_is_token($self->maintainer, undef, 128)
Truth table0%0/3
A and not(B)
A= $self->maintainerB= not Net::DRI::Util::xml_is_token($self->maintainer, undef, 128)
ABresult
0X0
100
111
99 0 ▶ push @errs,'email_sponsor' if ($self->email_sponsor() && !Net::DRI::Util::xml_is_token($self->email_sponsor(),1,undef) && !Email::Valid->rfc822($self->email_sponsor()));
Branch: 1 branch
BranchTrueFalseTotal
if $self->email_sponsor and not Net::DRI::Util::xml_is_token($self->email_sponsor, 1, undef) and not "Email::Valid"->rfc822($self->email_sponsor) 0 0 0
Condition0%0/6
$self->email_sponsor and not Net::DRI::Util::xml_is_token($self->email_sponsor, 1, undef) and not "Email::Valid"->rfc822($self->email_sponsor)
!ll&&!rl&&r
000
$self->email_sponsor and not Net::DRI::Util::xml_is_token($self->email_sponsor, 1, undef)
!ll&&!rl&&r
000
MC/DC0%0/3
$self->email_sponsor and not Net::DRI::Util::xml_is_token($self->email_sponsor, 1, undef) and not "Email::Valid"->rfc822($self->email_sponsor)
$self->email_sponsor not Net::DRI::Util::xml_is_token($self->email_sponsor, 1, undef) not "Email::Valid"->rfc822($self->email_sponsor)
Truth table0%0/4
A and not(B) and not(C)
A= $self->email_sponsorB= not Net::DRI::Util::xml_is_token($self->email_sponsor, 1, undef)C= not "Email::Valid"->rfc822($self->email_sponsor)
ABCresult
0XX0
10X0
1100
1111
100  
101 0 ▶ push @errs,'srid' if ($self->srid() && $self->srid()=~m/^REG-/);
Branch: 1 branch
BranchTrueFalseTotal
if $self->srid and $self->srid =~ /^REG-/ 0 0 0
Condition0%0/3
$self->srid and $self->srid =~ /^REG-/
!ll&&!rl&&r
000
MC/DC0%0/2
$self->srid and $self->srid =~ /^REG-/
$self->srid $self->srid =~ /^REG-/
Truth table0%0/3
A and B
A= $self->sridB= $self->srid =~ /^REG-/
ABresult
0X0
100
111
102  
103 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
104  
105 0 return 1; ## everything ok.
106 }
107  
108 ####################################################################################################
109 2 1;
« DRI/Protocol/EPP/Extensions/EURid/Registrar.pm ↑ Summary DRI/Protocol/OpenSRS/XCP/Message.pm »