File Coverage

blib/lib/Net/DRI/Protocol/EPP/Extensions/Afilias/Message.pm
Criterion Covered Total %
statement 6 19 31.5
branch 0 4 0.0
condition 0 6 0.0
subroutine 2 4 50.0
pod 0 2 0.0
total 8 35 22.8


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, EPP Message for Afilias
2             ##
3             ## Copyright (c) 2010,2013 Patrick Mevzek . 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::Afilias::Message;
16              
17 1     1   744 use strict;
  1         3  
  1         32  
18 1     1   4 use warnings;
  1         2  
  1         198  
19              
20             ####################################################################################################
21              
22             sub register_commands
23             {
24 0     0 0   my ($class,$version)=@_;
25 0           return { 'message' => { 'result' => [ undef, \&parse ] } };
26             }
27              
28             ## Parse error message with a node in the oxrs namespace to enhance what is reported back to application
29             sub parse
30             {
31 0     0 0   my ($po,$otype,$oaction,$oname,$rinfo)=@_;
32 0           my $mes=$po->message();
33 0           my @r=$mes->results_extra_info();
34 0 0         return unless @r;
35              
36 0           foreach my $r (@r)
37             {
38 0           foreach my $rinfo (@$r)
39             {
40 0 0 0       next unless $rinfo->{from} eq 'eppcom:value' && $rinfo->{type} eq 'rawxml' && $rinfo->{message}=~m!^(.+?)$!;
      0        
41 0           $rinfo->{message}=$1;
42 0           $rinfo->{from}='oxrs';
43 0           $rinfo->{type}='text';
44             }
45             }
46 0           return;
47             }
48              
49             ####################################################################################################
50             1;
51              
52             __END__