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

filter: Statementstmt 26.3% 10 / 38 Branchbran 0.0% 0 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod 0.0% 0 / 4 totaltotal 19.4% 13 / 67 CC 12 SCAR 46.5
CC
12
Cov
18%
info_parse
156.0
register_commands
2.0
setup
2.0
CRAP 104.5
« DRI/Protocol/EPP/Extensions/VeriSign/TwoFactorAuth.pm ↑ Summary DRI/Data/Contact/CAT.pm »
1 ## Domain Registry Interface, EURid Registrar EPP extension commands
2 ## (introduced in release 5.6 october 2008)
3 ##
4 ## Copyright (c) 2009,2012,2013,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
5 ##
6 ## This file is part of Net::DRI
7 ##
8 ## Net::DRI is free software; you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation; either version 2 of the License, or
11 ## (at your option) any later version.
12 ##
13 ## See the LICENSE file that comes with this distribution for more details.
14 ####################################################################################################
15  
16 package Net::DRI::Protocol::EPP::Extensions::EURid::Registrar;
17  
18 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use warnings;
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::EURid::Registrar - EURid EPP Registrar extension commands 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) 2009,2012,2013,2018 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 {
67 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
68 0 my %tmp=(
69 info => [ \&info, \&info_parse ],
70 );
71  
72 0 return { 'registrar' => \%tmp };
73 }
74  
75 sub setup
76 {
77 0 ▶ my ($class,$po,$version)=@_;
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
78 0 $po->ns({ 'registrar' => 'http://www.eurid.eu/xml/epp/registrar-1.0' });
79 0 return;
80 }
81  
82 ####################################################################################################
83  
84 sub info
85 {
86 0 ▶ my ($epp,$domain,$rd)=@_;
Subroutine info: not called CC=1 SCAR=6.9
Pod undocumented
87 0 my $mes=$epp->message();
88 0 $mes->command('info','registrar:info',sprintf('xmlns:registrar="%s"',$mes->nsattrs('registrar')));
89 0 return;
90 }
91  
92 sub info_parse
93 {
94 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=12 SCAR=50.5
Pod undocumented
95 0 my $mes=$po->message();
96 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
97  
98 0 my $infdata=$mes->get_response('registrar','infData');
99 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
100  
101 0 foreach my $el (Net::DRI::Util::xml_list_children($infdata))
102 {
103 0 my ($name,$c)=@$el;
104 0 ▶ if ($name eq 'amountAvailable')
Branch: 3 branches
BranchTrueFalseTotal
if ($name eq 'amountAvailable') { } 0 0 0
elsif ($name eq 'hitPoints') { } 0 0 0
elsif ($name eq 'credits') { } 0 0 0
105 {
106 0 $rinfo->{registrar}->{info}->{amount_available}=0+$c->textContent();
107 } elsif ($name eq 'hitPoints')
108 {
109 0 $rinfo->{registrar}->{info}->{hitpoints}={};
110 0 foreach my $sel (Net::DRI::Util::xml_list_children($c))
111 {
112 0 my ($n,$cc)=@$sel;
113 0 ▶ if ($n eq 'nbrHitPoints')
Branch: 3 branches
BranchTrueFalseTotal
if ($n eq 'nbrHitPoints') { } 0 0 0
elsif ($n eq 'maxNbrHitPoints') { } 0 0 0
elsif ($n eq 'blockedUntil') { } 0 0 0
114 {
115 0 $rinfo->{registrar}->{info}->{hitpoints}->{current_number}=0+$cc->textContent();
116 } elsif ($n eq 'maxNbrHitPoints')
117 {
118 0 $rinfo->{registrar}->{info}->{hitpoints}->{maximum_number}=0+$cc->textContent();
119 } elsif ($n eq 'blockedUntil')
120 {
121 0 $rinfo->{registrar}->{info}->{hitpoints}->{blocked_until}=$po->parse_iso8601($cc->textContent());
122 }
123 }
124 } elsif ($name eq 'credits')
125 {
126 0 ▶ $rinfo->{registrar}->{info}->{credits}->{$c->getAttribute('type')}=($c->textContent() eq '')? undef : 0+$c->textContent();
Branch: 1 branch
BranchTrueFalseTotal
$c->textContent eq '' ? : 0 0 0
127 }
128 }
129 0 return;
130 }
131  
132 ####################################################################################################
133 1 1;
« DRI/Protocol/EPP/Extensions/VeriSign/TwoFactorAuth.pm ↑ Summary DRI/Data/Contact/CAT.pm »