DRI/Protocol/EPP/Extensions/DNSBE/Notifications.pm

filter: Statementstmt 27.7% 10 / 36 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 2 totaltotal 18.3% 13 / 71 CC 14 SCAR 51.0
CC
14
Cov
17%
parse
210.0
register_commands
2.0
BEGIN
1.0
CRAP 163.6
« DRI/Data/Contact/FCCN.pm ↑ Summary DRI/Protocol/EPP/Extensions/EURid/Domain.pm »
1 ## Domain Registry Interface, DNSBE Registrar EPP extension notifications
2 ## (introduced in release 5.6 october 2008)
3 ##
4 ## Copyright (c) 2013 Michael Holloway <michael@thedarkwinter.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::DNSBE::Notifications;
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::DNSBE::Notifications - DNSBE EPP Notifications Handling 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 Michael Holloway, E<lt>michael@thedarkwinter.comE<gt>
48  
49 =head1 COPYRIGHT
50  
51 Copyright (c) 2013 Michael Holloway <michael@thedarkwinter.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 notification => [ undef, \&parse ],
70 );
71  
72 0 return { 'message' => \%tmp };
73 }
74  
75 ####################################################################################################
76  
77 sub parse
78 {
79 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine parse: not called CC=14 SCAR=53.5
Pod undocumented
80 0 my $mes=$po->message();
81 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
82 0 my $poll=$mes->get_response('dnsbe','pollRes');
83 0 ▶ return unless defined $poll;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $poll 0 0 0
84  
85 0 my %n;
86 0 foreach my $el (Net::DRI::Util::xml_list_children($poll))
87 {
88 0 my ($name,$c)=@$el;
89 0 ▶ if ($name=~m/^(action|returncode|type|contact|domainname|date|email|level)$/)
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^(action|returncode|type|contact|domainname|date|email|level)$/) 0 0 0
90 {
91 0 $n{$1}=$c->textContent();
92 }
93 }
94  
95 # determin object type and set name/id
96 0 ▶ if (Net::DRI::Util::has_key(\%n,'domainname'))
Branch: 2 branches
BranchTrueFalseTotal
if (Net::DRI::Util::has_key(\%n, 'domainname')) { } 0 0 0
elsif (Net::DRI::Util::has_key(\%n, 'contact')) { } 0 0 0
97 {
98 0 $otype = 'domain';
99 0 $rinfo->{$otype}->{$oname}->{name} = $oname = $n{domainname};
100 } elsif (Net::DRI::Util::has_key(\%n,'contact'))
101 {
102 0 $otype='contact';
103 0 $rinfo->{$otype}->{$oname}->{srid} = $oname=$n{contact};
104 }
105  
106 # add other values to object if it is an object
107 0 ▶ if (defined $otype)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $otype) { } 0 0 0
108 {
109 0 $rinfo->{$otype}->{$oname}->{exist} = 1;
110 0 ▶ $rinfo->{$otype}->{$oname}->{date} = $po->parse_iso8601($n{date}) if Net::DRI::Util::has_key(\%n,'date') && length $n{date};
Branch: 1 branch
BranchTrueFalseTotal
if Net::DRI::Util::has_key(\%n, "date") and length $n{"date"} 0 0 0
Condition0%0/3
Net::DRI::Util::has_key(\%n, "date") and length $n{"date"}
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::has_key(\%n, "date") and length $n{"date"}
Net::DRI::Util::has_key(\%n, "date") length $n{"date"}
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key(\%n, "date")B= length $n{"date"}
ABresult
0X0
100
111
111 0 foreach ('action','returncode','type','contact','email','level')
112 {
113 0 ▶ $rinfo->{$otype}->{$oname}->{$_} = $n{$_} if defined $n{$_};
Branch: 1 branch
BranchTrueFalseTotal
if defined $n{$_} 0 0 0
114 }
115 } else
116 {
117 0 $rinfo->{session}->{notification}=\%n;
118 }
119 0 ▶ $oname=undef if defined $otype && $otype eq 'contact';
Branch: 1 branch
BranchTrueFalseTotal
if defined $otype and $otype eq "contact" 0 0 0
Condition0%0/3
defined $otype and $otype eq "contact"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $otype and $otype eq "contact"
defined $otype $otype eq "contact"
Truth table0%0/3
A and B
A= defined $otypeB= $otype eq "contact"
ABresult
0X0
100
111
120 0 return;
121 }
122  
123 ####################################################################################################
124 1 1;
« DRI/Data/Contact/FCCN.pm ↑ Summary DRI/Protocol/EPP/Extensions/EURid/Domain.pm »