DRI/Protocol/EPP/Extensions/Nominet/Message.pm untested

filter: Statementstmt 0.0% 0 / 34 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 44 CC 2 SCAR 11.5
CC
2
Cov
0%
parse
6.0
register_commands
2.0
BEGIN
2.0
CRAP 3.1
1 ## Domain Registry Interface, Nominet Message Parsing
2 ##
3 ## Copyright (c) 2005-2010,2012 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
4 ## (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::Nominet::Message;
17  
18 use strict;
19 use warnings;
20  
21 use Net::DRI::Util;
22 use Net::DRI::Exception;
23  
24  
25 ####################################################################################################
26  
27 sub register_commands
28 {
29 my ($class,$version)=@_;
30 return { 'message' => { 'result' => [ undef, \&parse ] } };
31 }
32  
33 # To get warning fields from std-warning-1.1
34 sub parse
35 {
36 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
37 my $mes=$po->message();
38  
39 ## Parse warnings
40 my $result = $mes->node_extension();
41 return unless $result;
42 my $warnTypes = {
43 'credit-limit' => 'remaining',
44 'glue-removed' => 'nameserverName',
45 'glue-ignored' => 'ip',
46 'deprecated-field' => ['field-name','processed'],
47 'reg-type-set' => 'setTo',
48 'account-id-ignored' => undef,
49 'contact-moved' => ['original','final'],
50 'ignored-field' => 'field-name',
51 'ignored-attribute' => 'attribute-name',
52 'postalInfo-ignored' => 'type',
53 'truncated-field' => 'field-name',
54 'host-ignored' => 'host-name',
55 'registrar-account-forked' => 'registrant',
56 };
57 foreach my $wt (keys %$warnTypes)
58 {
59 ## We add it to the extra_info.. for now ?
60 foreach my $el ($result->getChildrenByTagName('warning:'.$wt))
61 {
62 my $str = "$wt: ";
63 foreach my $attr ($warnTypes->{$wt}) { $str .= "[$attr:" . $el->getAttribute($attr) . "] "; }
64 $str .= $el->textContent();
65 $mes->add_to_extra_info({from => 'nominet', type => 'text', message => $str});
66 }
67 }
68 return;
69 }
70  
71 1;