DRI/Protocol/EPP/Extensions/ChangePoll.pm

filter: Statementstmt 31.7% 13 / 41 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 50.0% 4 / 8 Podpod 0.0% 0 / 4 totaltotal 21.7% 17 / 78 CC 14 SCAR 49.5
CC
14
Cov
20%
parse
210.0
register_commands
2.0
setup
2.0
CRAP 140.5
« DRI/Registry.pm ↑ Summary DRI/Protocol/EPP/Extensions/TCI/Contact.pm »
1 ## Domain Registry Interface, Change Poll Extension Mapping for EPP (RFC8590)
2 ##
3 ## Copyright (c) 2015,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::ChangePoll;
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 ####################################################################################################
24  
25 sub register_commands
26 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
27 0 my ($class,$version)=@_;
28  
29 0 state $rops = { 'session' => { change_poll => [ undef, \&parse ] } };
30  
31 0 return $rops;
32 }
33  
34 sub setup
35 0 ▶{
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
36 0 my ($class,$po,$version)=@_;
37 0 state $ns = { 'changepoll' => 'urn:ietf:params:xml:ns:changePoll-1.0' };
38 0 $po->ns($ns);
39 0 return;
40 }
41  
42 0 ▶sub implements { return 'https://tools.ietf.org/html/rfc8590'; }
Subroutine implements: not called CC=1 SCAR=6.9
Pod undocumented
43  
44 ####################################################################################################
45  
46 sub parse
47 0 ▶{
Subroutine parse: not called CC=14 SCAR=53.5
Pod undocumented
48 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
49 0 my $mes=$po->message();
50 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
51  
52 0 my $data=$mes->get_extension('changepoll','changeData');
53 0 ▶ return unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 0 0
54  
55 0 ▶ my %r=('state' => $data->hasAttribute('state') ? $data->getAttribute('state') : 'after');
Branch: 1 branch
BranchTrueFalseTotal
$data->hasAttribute('state') ? : 0 0 0
56 0 foreach my $el (Net::DRI::Util::xml_list_children($data))
57 {
58 0 my ($name,$node)=@$el;
59 0 ▶ if ($name eq 'operation')
Branch: 5 branches
BranchTrueFalseTotal
if ($name eq 'operation') { } 0 0 0
elsif ($name =~ /^(who|svTRID)$/) { } 0 0 0
elsif ($name eq 'date') { } 0 0 0
elsif ($name eq 'caseId') { } 0 0 0
elsif ($name eq 'reason') { } 0 0 0
60 {
61 0 my $value=$node->textContent();
62 0 ▶ $r{$name}=$node->hasAttribute('op') ? [ $value, $node->getAttribute('op') ] : $value;
Branch: 1 branch
BranchTrueFalseTotal
$node->hasAttribute('op') ? : 0 0 0
63 } elsif ($name=~m/^(who|svTRID)$/)
64 {
65 0 $r{$name}=$node->textContent();
66 } elsif ($name eq 'date')
67 {
68 0 $r{$name}=$po->parse_iso8601($node->textContent());
69 } elsif ($name eq 'caseId')
70 {
71 0 my $type=$node->getAttribute('type');
72 0 ▶ $type=$node->getAttribute('name') if $type eq 'custom';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "custom" 0 0 0
73 0 $r{case}={ type => $type, id => $node->textContent() };
74 } elsif ($name eq 'reason')
75 {
76 0 ▶ $r{reason} = $node->hasAttribute('lang') ? { lang => $node->getAttribute('lang') // 'en', msg => $node->textContent() } : $node->textContent();
Branch: 1 branch
BranchTrueFalseTotal
$node->hasAttribute('lang') ? : 0 0 0
Condition0%0/2
$node->getAttribute("lang") // "en"
l!l
00
MC/DC0%0/1
$node->getAttribute("lang") // "en"
$node->getAttribute("lang")
Truth table0%0/2
A
A= $node->getAttribute("lang")
Aresult
11
00
77 }
78 }
79  
80 0 my $msgid=$mes->msg_id();
81 0 $rinfo->{message}->{$msgid}->{change}=\%r;
82 0 return;
83 }
84  
85 ####################################################################################################
86 1 1;
87  
88 __END__
« DRI/Registry.pm ↑ Summary DRI/Protocol/EPP/Extensions/TCI/Contact.pm »