DRI/Protocol/EPP/Extensions/EURid/Contact.pm

filter: Statementstmt 21.2% 10 / 47 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 37.5% 3 / 8 Podpod 0.0% 0 / 5 totaltotal 15.6% 13 / 83 CC 12 SCAR 31.2
CC
12
Cov
15%
update
42.0
info_parse
30.0
setup
6.0
CRAP 22.7
« DRI/Protocol/EPP/Extensions/VeriSign/WhoisInfo.pm ↑ Summary DRI/Data/Contact/BR.pm »
1 ## Domain Registry Interface, EURid Contact EPP extension commands
2 ## (based on EURid registration_guidelines_v1_0E-epp.pdf)
3 ##
4 ## Copyright (c) 2005,2008,2012,2013,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
5 ## 2014 Michael Kefeder <michael.kefeder@world4you.com>. All rights reserved.
6 ##
7 ## This file is part of Net::DRI
8 ##
9 ## Net::DRI is free software; you can redistribute it and/or modify
10 ## it under the terms of the GNU General Public License as published by
11 ## the Free Software Foundation; either version 2 of the License, or
12 ## (at your option) any later version.
13 ##
14 ## See the LICENSE file that comes with this distribution for more details.
15 ####################################################################################################
16  
17 package Net::DRI::Protocol::EPP::Extensions::EURid::Contact;
18  
19 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 =pod
25  
26 =head1 NAME
27  
28 Net::DRI::Protocol::EPP::Extensions::EURid::Contact - EURid EPP Contact extension commands for Net::DRI
29  
30 =head1 DESCRIPTION
31  
32 Please see the README file for details.
33  
34 =head1 SUPPORT
35  
36 For now, support questions should be sent to:
37  
38 E<lt>netdri@dotandco.comE<gt>
39  
40 Please also see the SUPPORT file in the distribution.
41  
42 =head1 SEE ALSO
43  
44 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
45  
46 =head1 AUTHOR
47  
48 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
49  
50 =head1 COPYRIGHT
51  
52 Copyright (c) 2005,2008,2012,2013,2018 Patrick Mevzek <netdri@dotandco.com>.
53 2014 Michael Kefeder <michael.kefeder@world4you.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 register_commands
68 {
69 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
70 0 my %tmp=(
71 create => [ \&create, undef ],
72 update => [ \&update, undef ],
73 info => [ undef, \&info_parse ],
74 );
75  
76 0 return { 'contact' => \%tmp };
77 }
78  
79 sub setup
80 {
81 0 ▶ my ($class,$po,$version)=@_;
Subroutine setup: not called CC=2 SCAR=17.9
Pod undocumented
82 0 foreach my $ns (qw/contact-ext/)
83 {
84 0 $po->ns({ $ns => 'http://www.eurid.eu/xml/epp/'.$ns.'-1.1' });
85 }
86 0 return;
87 }
88  
89 ####################################################################################################
90  
91 sub create
92 {
93 0 ▶ my ($epp,$contact)=@_;
Subroutine create: not called CC=2 SCAR=17.9
Pod undocumented
94 0 my $mes=$epp->message();
95  
96 ## validate() has been called, we are sure that type & lang exists
97 0 my @n;
98 0 push @n,['contact-ext:type',$contact->type()];
99 0 ▶ push @n,['contact-ext:vat',$contact->vat()] if $contact->vat();
Branch: 1 branch
BranchTrueFalseTotal
if $contact->vat 0 0 0
100 0 push @n,['contact-ext:lang',$contact->lang()];
101  
102 0 my $eid=$mes->command_extension_register('contact-ext','create');
103 0 $mes->command_extension($eid,\@n);
104 0 return;
105 }
106  
107 sub update
108 {
109 0 ▶ my ($epp,$domain,$todo)=@_;
Subroutine update: not called CC=6 SCAR=37.4
Pod undocumented
110 0 my $mes=$epp->message();
111  
112 0 my $newc=$todo->set('info');
113 0 ▶ return unless ($newc && (defined($newc->vat()) || defined($newc->lang())));
Branch: 1 branch
BranchTrueFalseTotal
unless $newc and defined $newc->vat || defined $newc->lang 0 0 0
Condition0%0/6
$newc and defined $newc->vat || defined $newc->lang
!ll&&!rl&&r
000
defined $newc->vat or defined $newc->lang
l!l&&r!l&&!r
000
MC/DC0%0/3
$newc and defined $newc->vat || defined $newc->lang
$newc defined $newc->vat defined $newc->lang
Truth table0%0/4
A and B or C
A= $newcB= defined $newc->vatC= defined $newc->lang
ABCresult
0XX0
1000
11X1
1011
114  
115 0 my @n;
116 0 ▶ push @n,['contact-ext:vat',$newc->vat()] if defined($newc->vat());
Branch: 1 branch
BranchTrueFalseTotal
if defined $newc->vat 0 0 0
117 0 ▶ push @n,['contact-ext:lang',$newc->lang()] if defined($newc->lang());
Branch: 1 branch
BranchTrueFalseTotal
if defined $newc->lang 0 0 0
118  
119 0 my $eid=$mes->command_extension_register('contact-ext','update');
120 0 $mes->command_extension($eid,['contact-ext:chg',@n]);
121 0 return;
122 }
123  
124 sub info_parse
125 {
126 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=5 SCAR=34.0
Pod undocumented
127 0 my $mes=$po->message();
128 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
129  
130 0 my $infdata=$mes->get_extension('contact-ext','infData');
131 0 ▶ return unless $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless $infdata 0 0 0
132  
133 0 my $s=$rinfo->{contact}->{$oname}->{self};
134 0 foreach my $el (Net::DRI::Util::xml_list_children($infdata))
135 {
136 0 my ($name,$c)=@$el;
137 0 ▶ if ($name=~m/^(type|vat|lang)$/)
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^(type|vat|lang)$/) 0 0 0
138 {
139 0 $s->$1($c->textContent());
140 }
141 }
142 0 return;
143 }
144  
145 ####################################################################################################
146 1 1;
« DRI/Protocol/EPP/Extensions/VeriSign/WhoisInfo.pm ↑ Summary DRI/Data/Contact/BR.pm »