File Coverage

blib/lib/Net/DRI/Protocol/EPP/Extensions/AT/Result.pm
Criterion Covered Total %
statement 12 35 34.2
branch 0 12 0.0
condition 0 3 0.0
subroutine 4 6 66.6
pod 0 2 0.0
total 16 58 27.5


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, ENUM.AT Result Condition
2             ## Contributed by Michael Braunoeder from ENUM.AT
3             ##
4             ## Copyright (c) 2006,2007,2013 Patrick Mevzek . 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::AT::Result;
17              
18 1     1   854 use strict;
  1         1  
  1         29  
19 1     1   4 use warnings;
  1         1  
  1         27  
20              
21 1     1   4 use Net::DRI::Util;
  1         2  
  1         14  
22 1     1   4 use Net::DRI::Exception;
  1         1  
  1         356  
23              
24             our $NS='http://www.enum.at/rxsd/ienum43-result-1.0';
25              
26             =pod
27              
28             =head1 NAME
29              
30             Net::DRI::Protocol::EPP::Extensions::AT::Result - ENUM.AT Result Condition EPP Mapping for Net::DRI
31              
32             =head1 DESCRIPTION
33              
34             Please see the README file for details.
35              
36             =head1 SUPPORT
37              
38             For now, support questions should be sent to:
39              
40             Enetdri@dotandco.comE
41              
42             Please also see the SUPPORT file in the distribution.
43              
44             =head1 SEE ALSO
45              
46             Ehttp://www.dotandco.com/services/software/Net-DRI/E
47              
48             =head1 AUTHOR
49              
50             Patrick Mevzek, Enetdri@dotandco.comE
51              
52             =head1 COPYRIGHT
53              
54             Copyright (c) 2006,2007,2013 Patrick Mevzek .
55             All rights reserved.
56              
57             This program is free software; you can redistribute it and/or modify
58             it under the terms of the GNU General Public License as published by
59             the Free Software Foundation; either version 2 of the License, or
60             (at your option) any later version.
61              
62             See the LICENSE file that comes with this distribution for more details.
63              
64             =cut
65              
66             ####################################################################################################
67              
68             sub register_commands
69             {
70 0     0 0   my ($class,$version)=@_;
71 0           my %tmp=(
72             login => [ undef, \&condition_parse ],
73             check => [ undef, \&condition_parse ],
74             info => [ undef, \&condition_parse ],
75             transfer_query => [ undef, \&condition_parse ],
76             create => [ undef, \&condition_parse ],
77             delete => [ undef, \&condition_parse],
78             transfer_request => [ undef, \&condition_parse ],
79             transfer_cancel => [ undef,\&condition_parse ],
80             transfer_answer => [ undef,\&condition_parse ],
81             update => [ undef, \&condition_parse ],
82             );
83              
84 0           return { 'domain' => \%tmp };
85             }
86              
87              
88             sub condition_parse
89             {
90 0     0 0   my ($po,$otype,$oaction,$oname,$rinfo)=@_;
91 0           my $mes=$po->message();
92              
93 0           my $condata=$mes->get_extension($NS,'conditions');
94 0 0         return unless $condata;
95              
96 0           my @conditions;
97              
98 0           foreach my $el ($condata->getElementsByTagNameNS($NS,'condition'))
99             {
100 0           my %con;
101 0           my $c=$el->getFirstChild();
102              
103 0 0         $con{code}=$el->getAttribute('code') if $el->getAttribute('code');
104 0 0         $con{severity}=$el->getAttribute('severity') if $el->getAttribute('severity');
105              
106 0           while ($c)
107             {
108 0 0         next unless ($c->nodeType() == 1); ## only for element nodes
109 0   0       my $name=$c->localname() || $c->nodeName();
110 0 0         next unless $name;
111 0 0         if ($name=~m/^(msg|details)$/)
112             {
113 0           $con{$1}=$c->getFirstChild()->getData();
114             }
115 0           } continue { $c=$c->getNextSibling(); }
116 0           push @conditions,\%con;
117             }
118              
119 0           $rinfo->{domain}->{$oname}->{conditions}=\@conditions;
120 0           return;
121             }
122              
123             ####################################################################################################
124             1;