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

filter: Statementstmt 28.8% 13 / 45 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 44.4% 4 / 9 Podpod 0.0% 0 / 5 totaltotal 19.7% 17 / 86 CC 12 SCAR 33.4
CC
12
Cov
19%
info_parse
56.0
update
30.0
create
6.0
CRAP 28.1
« DRI/Protocol/EPP/Extensions/CentralNic/TTL.pm ↑ Summary DRI/Protocol/EPP/Extensions/Reverse.pm »
1 ## Domain Registry Interface, EPP .US Contact NEXUS Extensions
2 ##
3 ## Copyright (c) 2005,2006,2008,2013,2016,2018-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::US::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 1 ▶use feature 'state';
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 =pod
24  
25 =head1 NAME
26  
27 Net::DRI::Protocol::EPP::Extensions::US::Contact - .US EPP Contact NEXUS Extensions for Net::DRI
28  
29 =head1 DESCRIPTION
30  
31 Please see the README file for details.
32  
33 =head1 SUPPORT
34  
35 For now, support questions should be sent to:
36  
37 E<lt>netdri@dotandco.comE<gt>
38  
39 Please also see the SUPPORT file in the distribution.
40  
41 =head1 SEE ALSO
42  
43 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
44  
45 =head1 AUTHOR
46  
47 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
48  
49 =head1 COPYRIGHT
50  
51 Copyright (c) 2005,2006,2008,2013,2016,2018-2019 Patrick Mevzek <netdri@dotandco.com>.
52 All rights reserved.
53  
54 This program is free software; you can redistribute it and/or modify
55 it under the terms of the GNU General Public License as published by
56 the Free Software Foundation; either version 2 of the License, or
57 (at your option) any later version.
58  
59 See the LICENSE file that comes with this distribution for more details.
60  
61 =cut
62  
63 ###################################################################################################
64  
65 sub register_commands
66 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
67 0 my ($class,$version)=@_;
68 0 state $cmds = { 'contact' => {
69 info => [ undef, \&info_parse ],
70 create => [ \&create, undef ],
71 update => [ \&update, undef ],
72 }
73 };
74  
75 0 return $cmds;
76 }
77  
78 sub setup
79 0 ▶{
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
80 0 my ($class,$po,$version)=@_;
81 0 state $rns = { 'neulevel' => 'urn:ietf:params:xml:ns:neulevel-1.0' };
82 0 $po->ns($rns);
83 0 return;
84 }
85  
86 ####################################################################################################
87  
88 ########### Query commands
89  
90 sub info_parse
91 0 ▶{
Subroutine info_parse: not called CC=7 SCAR=40.3
Pod undocumented
92 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
93 0 my $mes=$po->message();
94 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
95  
96 0 my $contact=$rinfo->{contact}->{$oname}->{self};
97 0 my $ext=$mes->node_extension();
98  
99 0 ▶ return unless (defined($ext) && $ext && $ext->getFirstChild());
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ext and $ext and $ext->getFirstChild 0 0 0
Condition0%0/6
defined $ext and $ext and $ext->getFirstChild
!ll&&!rl&&r
000
defined $ext and $ext
!ll&&!rl&&r
000
MC/DC0%0/3
defined $ext and $ext and $ext->getFirstChild
defined $ext $ext $ext->getFirstChild
Truth table0%0/4
A and B and C
A= defined $extB= $extC= $ext->getFirstChild
ABCresult
0XX0
10X0
1100
1111
100 0 my %tmp=map { split(/=/,$_) } split(/\s+/,$ext->getFirstChild()->getData());
101  
102 0 ▶ $contact->application_purpose($tmp{AppPurpose}) if exists($tmp{AppPurpose});
Branch: 1 branch
BranchTrueFalseTotal
if exists $tmp{"AppPurpose"} 0 0 0
103 0 ▶ $contact->nexus_category($tmp{NexusCategory}) if exists($tmp{NexusCategory});
Branch: 1 branch
BranchTrueFalseTotal
if exists $tmp{"NexusCategory"} 0 0 0
104 0 return;
105 }
106  
107 ############ Transform commands
108  
109 sub create
110 0 ▶{
Subroutine create: not called CC=2 SCAR=17.9
Pod undocumented
111 0 my ($epp,$contact)=@_;
112  
113 0 ▶ return unless Net::DRI::Util::isa_contact($contact,'Net::DRI::Data::Contact::US');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($contact, "Net::DRI::Data::Contact::US") 0 0 0
114  
115 0 my $str=sprintf('AppPurpose=%s NexusCategory=%s',$contact->application_purpose(),$contact->nexus_category());
116 0 $epp->message()->command_extension('neulevel', ['extension', ['neulevel:unspec',$str]]);
117 0 return;
118 }
119  
120 sub update
121 0 ▶{
Subroutine update: not called CC=5 SCAR=34.0
Pod undocumented
122 0 my ($epp,$contact,$todo)=@_;
123  
124 0 my $newc=$todo->set('info');
125 0 ▶ return unless Net::DRI::Util::isa_contact($newc,'Net::DRI::Data::Contact::US');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($newc, "Net::DRI::Data::Contact::US") 0 0 0
126  
127 0 my @tmp;
128 0 ▶ push @tmp,'AppPurpose='.$newc->application_purpose() if (defined($newc->application_purpose()));
Branch: 1 branch
BranchTrueFalseTotal
if defined $newc->application_purpose 0 0 0
129 0 ▶ push @tmp,'NexusCategory='.$newc->nexus_category() if (defined($newc->nexus_category()));
Branch: 1 branch
BranchTrueFalseTotal
if defined $newc->nexus_category 0 0 0
130  
131 0 ▶ return unless @tmp;
Branch: 1 branch
BranchTrueFalseTotal
unless @tmp 0 0 0
132  
133 0 $epp->message()->command_extension('neulevel', ['extension', ['neulevel:unspec',join(' ',@tmp)]]);
134 0 return;
135 }
136  
137 ####################################################################################################
138 1 1;
« DRI/Protocol/EPP/Extensions/CentralNic/TTL.pm ↑ Summary DRI/Protocol/EPP/Extensions/Reverse.pm »