File Coverage

blib/lib/Net/DRI/Protocol/EPP/Extensions/AT/ATResult.pm
Criterion Covered Total %
statement 6 33 18.1
branch 0 14 0.0
condition 0 3 0.0
subroutine 2 4 50.0
pod 0 2 0.0
total 8 56 14.2


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