DRI/Protocol/EPP/Extensions/LU/Poll.pm

filter: Statementstmt 32.5% 13 / 40 Branchbran 0.0% 0 / 24 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 2 totaltotal 20.7% 17 / 82 CC 15 SCAR 51.9
CC
15
Cov
19%
parse
240.0
register_commands
2.0
BEGIN
1.0
CRAP 180.3
« DRI/Transport/HTTP.pm ↑ Summary DRI/Data/Contact/FCCN.pm »
1 ## Domain Registry Interface, EPP DNS-LU Poll extensions
2 ##
3 ## Copyright (c) 2007,2008,2013 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::LU::Poll;
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 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 ▶use DateTime::Format::ISO8601;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 =pod
25  
26 =head1 NAME
27  
28 Net::DRI::Protocol::EPP::Extensions::LU::Poll - EPP DNS-LU Poll extensions (DocRegistrar-2.0.6.pdf pages 35-37) for Net::DRI
29  
30 =head1 DESCRIPTION
31  
32 Please see the README file for details.
33  
34 =head1 SUPPORT
35  
36 For now, support questions should be sent to:
37  
38 E<lt>netdri@dotandco.comE<gt>
39  
40 Please also see the SUPPORT file in the distribution.
41  
42 =head1 SEE ALSO
43  
44 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
45  
46 =head1 AUTHOR
47  
48 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
49  
50 =head1 COPYRIGHT
51  
52 Copyright (c) 2007,2008,2013 Patrick Mevzek <netdri@dotandco.com>.
53 All rights reserved.
54  
55 This program is free software; you can redistribute it and/or modify
56 it under the terms of the GNU General Public License as published by
57 the Free Software Foundation; either version 2 of the License, or
58 (at your option) any later version.
59  
60 See the LICENSE file that comes with this distribution for more details.
61  
62 =cut
63  
64 ####################################################################################################
65  
66 sub register_commands
67 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
68 0 my ($class,$version)=@_;
69 0 my %tmp=(
70 dnslu => [ undef, \&parse ],
71 );
72 0 return { 'message' => \%tmp };
73 }
74  
75 ####################################################################################################
76  
77 sub parse
78 0 ▶{
Subroutine parse: not called CC=15 SCAR=54.8
Pod undocumented
79 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
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  
83 0 my $infdata=$mes->node_msg();
84 0 ▶ return unless $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless $infdata 0 0 0
85  
86 0 my $pollmsg=$infdata->getFirstChild();
87 0 my %w=(action => 'dnslu_notification', type => $infdata->getAttribute('type')); ## list of types p.36
88 0 ▶ $w{type}=$pollmsg->getAttribute('type') if (!defined($w{type}) && $pollmsg->localname() eq 'pollmsg');
Branch: 1 branch
BranchTrueFalseTotal
if not defined $w{"type"} and $pollmsg->localname eq "pollmsg" 0 0 0
Condition0%0/3
not defined $w{"type"} and $pollmsg->localname eq "pollmsg"
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $w{"type"} and $pollmsg->localname eq "pollmsg"
not defined $w{"type"} $pollmsg->localname eq "pollmsg"
Truth table0%0/3
not(A) and B
A= not defined $w{"type"}B= $pollmsg->localname eq "pollmsg"
ABresult
0X0
100
111
89  
90 0 my (%ns,%e);
91 0 my $c=$pollmsg->getFirstChild();
92 0 ▶ while ($c)
Branch: 1 branch
BranchTrueFalseTotal
if ($c) 0 0 0
93 {
94 0 ▶ next unless ($c->nodeType() == 1); ## only for element nodes
Branch: 1 branch
BranchTrueFalseTotal
unless $c->nodeType == 1 0 0 0
95 0 ▶ my $name=$c->localname() || $c->nodeName();
Condition0%0/3
$c->localname || $c->nodeName
l!l&&r!l&&!r
000
MC/DC0%0/2
$c->localname || $c->nodeName
$c->localname $c->nodeName
Truth table0%0/3
A || B
A= $c->localnameB= $c->nodeName
ABresult
1X1
011
000
96 0 ▶ next unless $name;
Branch: 1 branch
BranchTrueFalseTotal
unless $name 0 0 0
97  
98 0 ▶ if ($name=~m/^(roid|object|clTRID|svTRID|reason)$/)
Branch: 4 branches
BranchTrueFalseTotal
if ($name =~ /^(roid|object|clTRID|svTRID|reason)$/) { } 0 0 0
elsif ($name eq 'exDate') { } 0 0 0
elsif ($name eq 'ns') { } 0 0 0
elsif ($name eq 'extra') { } 0 0 0
99 {
100 0 $w{$name}=$c->getFirstChild()->getData();
101 } elsif ($name eq 'exDate')
102 {
103 0 $w{$name}=DateTime::Format::ISO8601->new()->parse_datetime($c->getFirstChild()->getData());
104 } elsif ($name eq 'ns')
105 {
106 0 $ns{$c->getAttribute('name')}=$c->getFirstChild()->getData();
107 } elsif ($name eq 'extra')
108 {
109 0 $e{$c->getAttribute('name')}=$c->getFirstChild()->getData();
110 }
111  
112 0 } continue { $c=$c->getNextSibling(); }
113 0 ▶ $w{ns}=\%ns if %ns;
Branch: 1 branch
BranchTrueFalseTotal
if %ns 0 0 0
114 0 ▶ $w{extra}=\%e if %e;
Branch: 1 branch
BranchTrueFalseTotal
if %e 0 0 0
115  
116 0 $rinfo->{session}->{notification}=\%w;
117 0 return;
118 }
119  
120 ####################################################################################################
121 1 1;
« DRI/Transport/HTTP.pm ↑ Summary DRI/Data/Contact/FCCN.pm »