EPP/Frame/Response.pm

filter: Statementstmt 20.0% 7 / 35 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 16.6% 2 / 12 Podpod 22.2% 2 / 9 totaltotal 18.3% 11 / 60 CC 3 SCAR 11.0
CC
3
Cov
18%
code
6.0
msg
6.0
new
2.0
CRAP 3.0
« EPP/Frame/ObjectSpec.pm ↑ Summary EPP/Frame/Command/Info/Domain.pm »
1 package Net::EPP::Frame::Response;
2 1 ▶use Net::EPP::ResponseCodes;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use base qw(Net::EPP::Frame);
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 =pod
6  
7 =head1 NAME
8  
9 Net::EPP::Frame::Response - an instance of L<Net::EPP::Frame> for server responses
10  
11 =head1 DESCRIPTION
12  
13 This module is a subclass of L<Net::EPP::Frame> that represents EPP server
14 responses.
15  
16 Responses are sent back to clients when the server receives a
17 C<E<lt>commandE<gt>> frame.
18  
19 =head1 OBJECT HIERARCHY
20  
21 L<XML::LibXML::Node>
22 +----L<XML::LibXML::Document>
23 +----L<Net::EPP::Frame>
24 +----L<Net::EPP::Frame::Response>
25  
26 =cut
27  
28 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
29 0 my $package = shift;
30 0 my $self = $package->SUPER::new('response');
31 0 return bless($self, $package);
32 }
33  
34 0 ▶sub _addExtraElements {
Subroutine _addExtraElements: not called CC=1 SCAR=6.9
35 0 my $self = shift;
36  
37 0 my $result = $self->createElement('result');
38 0 $result->appendChild($self->createElement('msg'));
39 0 $self->response->addChild($result);
40  
41 0 $self->result->setAttribute('code' => COMMAND_FAILED);
42  
43 0 $self->response->addChild($self->createElement('resData'));
44  
45 0 my $trID = $self->createElement('trID');
46 0 $trID->addChild($self->createElement('clTRID'));
47 0 $trID->addChild($self->createElement('svTRID'));
48 0 $self->response->addChild($trID);
49  
50 0 return 1;
51 }
52  
53 =pod
54  
55 =head1 METHODS
56  
57 my $node = $frame->response;
58  
59 This method returns the L<XML::LibXML::Element> object corresponding to the
60 C<E<lt>commandE<gt>> element.
61  
62 my $node = $frame->result;
63  
64 This method returns the L<XML::LibXML::Element> object corresponding to the
65 C<E<lt>resultE<gt>> element.
66  
67 my $node = $frame->resData;
68  
69 This method returns the L<XML::LibXML::Element> object corresponding to the
70 C<E<lt>resDataE<gt>> element.
71  
72 my $node = $frame->trID;
73  
74 This method returns the L<XML::LibXML::Element> object corresponding to the
75 C<E<lt>trIDE<gt>> element.
76  
77 my $node = $frame->clTRID;
78  
79 This method returns the L<XML::LibXML::Element> object corresponding to the
80 C<E<lt>clTRIDE<gt>> element.
81  
82 my $node = $frame->svTRID;
83  
84 This method returns the L<XML::LibXML::Element> object corresponding to the
85 C<E<lt>svTRIDE<gt>> element.
86  
87 =cut
88  
89 0 ▶sub response { $_[0]->getNode('response') }
Subroutine response: not called CC=1 SCAR=6.9
Pod documented
90 0 ▶sub result { $_[0]->getNode('result') }
Subroutine result: not called CC=1 SCAR=6.9
Pod undocumented
91 0 ▶sub resData { $_[0]->getNode('resData') }
Subroutine resData: not called CC=1 SCAR=6.9
Pod undocumented
92 0 ▶sub trID { $_[0]->getNode('trID') }
Subroutine trID: not called CC=1 SCAR=6.9
Pod undocumented
93 0 ▶sub clTRID { $_[0]->getNode('clTRID') }
Subroutine clTRID: not called CC=1 SCAR=6.9
Pod undocumented
94 0 ▶sub svTRID { $_[0]->getNode('svTRID') }
Subroutine svTRID: not called CC=1 SCAR=6.9
Pod undocumented
95  
96 =pod
97  
98 my $msg = $frame->code;
99  
100 This method returns the code attribute of the C<E<lt>resultE<gt>>
101 element.
102  
103 =cut
104  
105 0 ▶sub code {
Subroutine code: not called CC=2 SCAR=17.9
Pod undocumented
106 0 my $self = shift;
107 0 my $result = $self->result;
108 0 ▶ if ($result) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result) 0 0 0
109 0 return $result->getAttribute('code');
110 }
111 0 return COMMAND_FAILED;
112 }
113  
114 =pod
115  
116 my $msg = $frame->msg;
117  
118 This method returns a string containing the text content of the
119 C<E<lt>msgE<gt>> element.
120  
121 =cut
122  
123 0 ▶sub msg {
Subroutine msg: not called CC=2 SCAR=17.9
Pod undocumented
124 0 my $self = shift;
125 0 my $msgs = $self->getElementsByLocalName('msg');
126 0 ▶ return $msgs->shift->textContent if ($msgs->size == 1);
Branch: 1 branch
BranchTrueFalseTotal
if $msgs->size == 1 0 0 0
127 }
128  
129 1 1;
« EPP/Frame/ObjectSpec.pm ↑ Summary EPP/Frame/Command/Info/Domain.pm »