DRI/Protocol/EPP/Extensions/E164Validation/RFC5076.pm

filter: Statementstmt 25.4% 14 / 55 Branchbran 0.0% 0 / 30 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 36.3% 4 / 11 Podpod 0.0% 0 / 7 totaltotal 15.9% 18 / 113 CC 19 SCAR 41.3
CC
19
Cov
15%
create
132.0
info_parse
42.0
output_date
20.0
CRAP 61.9
« DRI/Data/Contact/IT.pm ↑ Summary DRI/Logging/Syslog.pm »
1 ## Domain Registry Interface, EPP E.164 Validation Information Example from RFC5076
2 ##
3 ## Copyright (c) 2008-2010,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::Protocol::EPP::Extensions::E164Validation::RFC5076;
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 Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 our $NS='urn:ietf:params:xml:ns:e164valex-1.1';
24  
25 =pod
26  
27 =head1 NAME
28  
29 Net::DRI::Protocol::EPP::Extensions::E164Validation::RFC5076 - EPP E.164 Validation Information Example from RFC5076 for Net::DRI
30  
31 =head1 DESCRIPTION
32  
33 Please see the README file for details.
34  
35 =head1 SUPPORT
36  
37 For now, support questions should be sent to:
38  
39 E<lt>netdri@dotandco.comE<gt>
40  
41 Please also see the SUPPORT file in the distribution.
42  
43 =head1 SEE ALSO
44  
45 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
46  
47 =head1 AUTHOR
48  
49 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
50  
51 =head1 COPYRIGHT
52  
53 Copyright (c) 2008-2010,2013 Patrick Mevzek <netdri@dotandco.com>.
54 All rights reserved.
55  
56 This program is free software; you can redistribute it and/or modify
57 it under the terms of the GNU General Public License as published by
58 the Free Software Foundation; either version 2 of the License, or
59 (at your option) any later version.
60  
61 See the LICENSE file that comes with this distribution for more details.
62  
63 =cut
64  
65 ####################################################################################################
66  
67 sub load
68 0 ▶{
Subroutine load: not called CC=1 SCAR=6.9
Pod undocumented
69 0 return $NS;
70 }
71  
72 sub info_parse
73 0 ▶{
Subroutine info_parse: not called CC=6 SCAR=37.4
Pod undocumented
74 0 my ($class,$po,$top)=@_;
75 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('Root element for information validation of URI='.$NS.' must be simpleVal') unless (($top->localname() || $top->nodeName()) eq 'simpleVal');
Branch: 1 branch
BranchTrueFalseTotal
unless ($top->localname || $top->nodeName) eq "simpleVal" 0 0 0
Condition0%0/3
$top->localname || $top->nodeName
l!l&&r!l&&!r
000
MC/DC0%0/2
$top->localname || $top->nodeName
$top->localname $top->nodeName
Truth table0%0/3
A || B
A= $top->localnameB= $top->nodeName
ABresult
1X1
011
000
76  
77 0 my %n;
78 0 foreach my $el (Net::DRI::Util::xml_list_children($top))
79 {
80 0 my ($name,$c)=@$el;
81 0 ▶ if ($name=~m/^(methodID|validationEntityID|registrarID)$/)
Branch: 2 branches
BranchTrueFalseTotal
if ($name =~ /^(methodID|validationEntityID|registrarID)$/) { } 0 0 0
elsif ($name =~ /^(executionDate|expirationDate)$/) { } 0 0 0
82 {
83 0 $n{Net::DRI::Util::remcam($1)}=$c->textContent();
84 } elsif ($name=~m/^(executionDate|expirationDate)$/)
85 {
86 0 $n{Net::DRI::Util::remcam($1)}=$po->parse_iso8601($c->textContent());
87 }
88 }
89 0 return \%n;
90 }
91  
92 sub output_date
93 0 ▶{
Subroutine output_date: not called CC=4 SCAR=30.0
Pod undocumented
94 0 my $d=shift;
95 0 ▶ return unless defined($d);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $d 0 0 0
96 0 ▶ if (Net::DRI::Util::is_class($d,'DateTime'))
Branch: 1 branch
BranchTrueFalseTotal
if (Net::DRI::Util::is_class($d, 'DateTime')) { } 0 0 0
97 {
98 0 return $d->strftime('%Y-%m-%d');
99 } else
100 {
101 0 ▶ return unless ($d=~m/^\d{4}-\d{2}-\d{2}$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $d =~ /^\d{4}-\d{2}-\d{2}$/ 0 0 0
102 0 return $d;
103 }
104 }
105  
106 sub create
107 0 ▶{
Subroutine create: not called CC=11 SCAR=48.8
Pod undocumented
108 0 my ($class,$rd)=@_;
109  
110 0 my @c;
111 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('method_id and execution_date are mandatory in validation information') unless (exists $rd->{method_id} && exists $rd->{execution_date});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $rd->{"method_id"} and exists $rd->{"execution_date"} 0 0 0
Condition0%0/3
exists $rd->{"method_id"} and exists $rd->{"execution_date"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $rd->{"method_id"} and exists $rd->{"execution_date"}
exists $rd->{"method_id"} exists $rd->{"execution_date"}
Truth table0%0/3
A and B
A= exists $rd->{"method_id"}B= exists $rd->{"execution_date"}
ABresult
0X0
100
111
112 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('method_id must be an xml token from 1 to 63 characters') unless Net::DRI::Util::xml_is_token($rd->{method_id},1,63);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::xml_is_token($rd->{"method_id"}, 1, 63) 0 0 0
113 0 push @c,['valex:methodID',$rd->{method_id}];
114  
115 0 ▶ if (exists $rd->{validation_entity_id})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rd->{"validation_entity_id"}) 0 0 0
116 {
117 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('validation_entity_id must be an xml token from 3 to 16 characters') unless Net::DRI::Util::xml_is_token($rd->{validation_entity_id},3,16);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::xml_is_token($rd->{"validation_entity_id"}, 3, 16) 0 0 0
118 0 push @c,['valex:validationEntityID',$rd->{validation_entity_id}];
119 }
120 0 ▶ if (exists $rd->{registrar_id})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rd->{"registrar_id"}) 0 0 0
121 {
122 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('registrar_id must be an xml token from 3 to 16 characters') unless Net::DRI::Util::xml_is_token($rd->{registrar_id},3,16);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::xml_is_token($rd->{"registrar_id"}, 3, 16) 0 0 0
123 0 push @c,['valex:registrarID',$rd->{registrar_id}];
124 }
125  
126 0 my $d=output_date($rd->{execution_date});
127 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('execution_date must be a DateTime object or a string like YYYY-MM-DD') unless defined($d);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $d 0 0 0
128 0 push @c,['valex:executionDate',$d];
129  
130 0 ▶ if (exists $rd->{expiration_date})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rd->{"expiration_date"}) 0 0 0
131 {
132 0 $d=output_date($rd->{expiration_date});
133 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('expiration_date must be a DateTime object or a string like YYYY-MM-DD') unless defined($d);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $d 0 0 0
134 0 push @c,['valex:expirationDate',$d];
135 }
136  
137 0 return ['valex:simpleVal',{'xmlns:valex' => $NS},@c];
138 }
139  
140 0 ▶sub renew { my (@args)=@_; return create(@args); }
Subroutine renew: not called CC=1 SCAR=6.9
Pod undocumented
141 0 ▶sub transfer { my (@args)=@_; return create(@args); }
Subroutine transfer: not called CC=1 SCAR=6.9
Pod undocumented
142 0 ▶sub update { my (@args)=@_; return create(@args); }
Subroutine update: not called CC=1 SCAR=6.9
Pod undocumented
143  
144 ####################################################################################################
145 1 1;
« DRI/Data/Contact/IT.pm ↑ Summary DRI/Logging/Syslog.pm »