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

filter: Statementstmt 17.5% 7 / 40 Branchbran 0.0% 0 / 22 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 28.5% 2 / 7 Podpod 0.0% 0 / 5 totaltotal 12.1% 9 / 74 CC 12 SCAR 30.6
CC
12
Cov
11%
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,2019 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,2019 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 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
64 0 my ($class,$version)=@_;
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 0 ▶{
Subroutine add_puntcat_extension: not called CC=4 SCAR=30.0
Pod undocumented
78 0 my ($contact)=@_;
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 0 ▶{
Subroutine create: not called CC=2 SCAR=17.9
Pod undocumented
91 0 my ($epp, $contact)=@_;
92  
93 0 my @n = add_puntcat_extension($contact);
94 0 ▶ $epp->message()->command_extension('cx', ['create', @n]) if @n;
Branch: 1 branch
BranchTrueFalseTotal
if @n 0 0 0
95  
96 0 return;
97 }
98  
99 sub update
100 0 ▶{
Subroutine update: not called CC=3 SCAR=24.8
Pod undocumented
101 0 my ($epp, $domain, $todo)=@_;
102  
103 0 my $newc=$todo->set('info');
104 0 ▶ return unless $newc; ## if there already verified in Core
Branch: 1 branch
BranchTrueFalseTotal
unless $newc 0 0 0
105  
106 0 my @n = add_puntcat_extension($newc);
107 0 ▶ $epp->message()->command_extension('cx', ['update', ['chg', @n]]) if @n;
Branch: 1 branch
BranchTrueFalseTotal
if @n 0 0 0
108  
109 0 return;
110 }
111  
112 sub info_parse
113 0 ▶{
Subroutine info_parse: not called CC=6 SCAR=37.4
Pod undocumented
114 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
115 0 my $mes=$po->message();
116 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
117  
118 0 my $infdata=$mes->get_extension('cx','infData');
119 0 ▶ return unless $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless $infdata 0 0 0
120  
121 0 my $s=$rinfo->{contact}->{$oname}->{self};
122 0 my $ns=$mes->ns('cx');
123 0 my $el=$infdata->getChildrenByTagNameNS($ns,'language');
124 0 ▶ $s->lang($el->get_node(1)->getFirstChild()->getData()) if $el;
Branch: 1 branch
BranchTrueFalseTotal
if $el 0 0 0
125 0 $el=$infdata->getChildrenByTagNameNS($ns,'maintainer');
126 0 ▶ $s->maintainer($el->get_node(1)->getFirstChild()->getData()) if $el;
Branch: 1 branch
BranchTrueFalseTotal
if $el 0 0 0
127 0 $el=$infdata->getChildrenByTagNameNS($ns,'sponsorEmail');
128 0 ▶ $s->email_sponsor($el->get_node(1)->getFirstChild()->getData()) if $el;
Branch: 1 branch
BranchTrueFalseTotal
if $el 0 0 0
129 0 return;
130 }
131  
132 ####################################################################################################
133 1 1;
« DRI/Data/Contact/SE.pm ↑ Summary DRI/Protocol/OVH/WS/Message.pm »