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

filter: Statementstmt 15.2% 7 / 46 Branchbran 0.0% 0 / 22 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 28.5% 2 / 7 Podpod 0.0% 0 / 5 totaltotal 11.2% 9 / 80 CC 12 SCAR 30.6
CC
12
Cov
10%
info_parse
42.0
add_puntcat_extension
20.0
update
12.0
CRAP 21.3
« DRI/Data/Contact/SE.pm ↑ Summary DRI/Protocol/OVH/WS/Message.pm »
1 ## Domain Registry Interface, .CAT Contact EPP extension commands
2 ##
3 ## Copyright (c) 2006,2008,2013,2016 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::CAT::Contact;
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 =pod
21  
22 =head1 NAME
23  
24 Net::DRI::Protocol::EPP::Extensions::CAT::Contact - .CAT EPP Contact extension commands for Net::DRI
25  
26 =head1 DESCRIPTION
27  
28 Please see the README file for details.
29  
30 =head1 SUPPORT
31  
32 For now, support questions should be sent to:
33  
34 E<lt>netdri@dotandco.comE<gt>
35  
36 Please also see the SUPPORT file in the distribution.
37  
38 =head1 SEE ALSO
39  
40 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
41  
42 =head1 AUTHOR
43  
44 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
45  
46 =head1 COPYRIGHT
47  
48 Copyright (c) 2006,2008,2013,2016 Patrick Mevzek <netdri@dotandco.com>.
49 All rights reserved.
50  
51 This program is free software; you can redistribute it and/or modify
52 it under the terms of the GNU General Public License as published by
53 the Free Software Foundation; either version 2 of the License, or
54 (at your option) any later version.
55  
56 See the LICENSE file that comes with this distribution for more details.
57  
58 =cut
59  
60 ####################################################################################################
61  
62 sub register_commands
63 {
64 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
65 0 my %tmp=(
66 create => [ \&create, undef ],
67 update => [ \&update, undef ],
68 info => [ undef, \&info_parse ],
69 );
70  
71 0 return { 'contact' => \%tmp };
72 }
73  
74 ####################################################################################################
75  
76 sub add_puntcat_extension
77 {
78 0 ▶ my ($contact)=@_;
Subroutine add_puntcat_extension: not called CC=4 SCAR=30.0
Pod undocumented
79  
80 ## Everything is optional
81 0 my @n;
82 0 ▶ push @n,['cx:language',$contact->lang()] if $contact->lang();
Branch: 1 branch
BranchTrueFalseTotal
if $contact->lang 0 0 0
83 0 ▶ push @n,['cx:maintainer',$contact->maintainer()] if $contact->maintainer();
Branch: 1 branch
BranchTrueFalseTotal
if $contact->maintainer 0 0 0
84 0 ▶ push @n,['cx:sponsorEmail',$contact->email_sponsor()] if $contact->email_sponsor();
Branch: 1 branch
BranchTrueFalseTotal
if $contact->email_sponsor 0 0 0
85  
86 0 return @n;
87 }
88  
89 sub create
90 {
91 0 ▶ my ($epp,$contact)=@_;
Subroutine create: not called CC=2 SCAR=17.9
Pod undocumented
92 0 my $mes=$epp->message();
93
94 0 my @n=add_puntcat_extension($contact);
95 0 ▶ return unless @n;
Branch: 1 branch
BranchTrueFalseTotal
unless @n 0 0 0
96  
97 0 my $eid=$mes->command_extension_register('cx', 'create');
98 0 $mes->command_extension($eid,\@n);
99 0 return;
100 }
101  
102 sub update
103 {
104 0 ▶ my ($epp,$domain,$todo)=@_;
Subroutine update: not called CC=3 SCAR=24.8
Pod undocumented
105 0 my $mes=$epp->message();
106  
107 0 my $newc=$todo->set('info');
108 0 ▶ return unless $newc; ## if there already verified in Core
Branch: 1 branch
BranchTrueFalseTotal
unless $newc 0 0 0
109  
110 0 my @n=add_puntcat_extension($newc);
111 0 ▶ return unless @n;
Branch: 1 branch
BranchTrueFalseTotal
unless @n 0 0 0
112  
113 0 my $eid=$mes->command_extension_register('cx', 'update');
114 0 $mes->command_extension($eid,['cx:chg',@n]);
115 0 return;
116 }
117  
118 sub info_parse
119 {
120 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=6 SCAR=37.4
Pod undocumented
121 0 my $mes=$po->message();
122 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
123  
124 0 my $infdata=$mes->get_extension('cx','infData');
125 0 ▶ return unless $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless $infdata 0 0 0
126  
127 0 my $s=$rinfo->{contact}->{$oname}->{self};
128 0 my $ns=$mes->ns('cx');
129 0 my $el=$infdata->getChildrenByTagNameNS($ns,'language');
130 0 ▶ $s->lang($el->get_node(1)->getFirstChild()->getData()) if $el;
Branch: 1 branch
BranchTrueFalseTotal
if $el 0 0 0
131 0 $el=$infdata->getChildrenByTagNameNS($ns,'maintainer');
132 0 ▶ $s->maintainer($el->get_node(1)->getFirstChild()->getData()) if $el;
Branch: 1 branch
BranchTrueFalseTotal
if $el 0 0 0
133 0 $el=$infdata->getChildrenByTagNameNS($ns,'sponsorEmail');
134 0 ▶ $s->email_sponsor($el->get_node(1)->getFirstChild()->getData()) if $el;
Branch: 1 branch
BranchTrueFalseTotal
if $el 0 0 0
135 0 return;
136 }
137  
138 ####################################################################################################
139 1 1;
« DRI/Data/Contact/SE.pm ↑ Summary DRI/Protocol/OVH/WS/Message.pm »