SRS/Result.pm

filter: Statementstmt 76.9% 40 / 52 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 66.6% 8 / 12 Podpod 0.0% 0 / 1 totaltotal 57.8% 48 / 83 CC 7 SCAR 20.4
CC
7
Cov
61%
__ANON__
20.0
__ANON__
12.0
result_id
6.0
CRAP 7.7
« SRS/DS.pm ↑ Summary SRS/ACL.pm »
1  
2 # this is called 'Response' in the XML, but we call it 'Result' to not clash
3 # with 'Response', which is actually 'NZSRSResponse'
4 package XML::SRS::Result;
5 5 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 $XML::SRS::Result::VERSION = '0.09';
7 }
8  
9 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 5 ▶use PRANG::Graph;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 5 ▶use XML::SRS::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 5 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 5 has_attr 'action' =>
16 is => "ro",
17 isa => "XML::SRS::ActionEtc",
18 required => 1,
19 xml_name => "Action",
20 ;
21  
22 5 has_attr 'fe_id' =>
23 is => "ro",
24 isa => "XML::SRS::Number",
25 required => 1,
26 xml_name => "FeId",
27 ;
28  
29 5 has_attr 'unique_id' =>
30 is => "ro",
31 isa => "XML::SRS::Number",
32 required => 1,
33 xml_name => "FeSeq",
34 ;
35  
36 # for identifying a result within a unique transaction
37 5 has 'part' =>
38 is => "rw",
39 isa => "Int",
40 ;
41  
42 0 ▶sub result_id {
Subroutine result_id: not called CC=2 SCAR=17.9
Pod undocumented
43 0 my $self = shift;
44 0 ▶ $self->fe_id.",".$self->unique_id
Branch: 1 branch
BranchTrueFalseTotal
$self->part ? : 0 0 0
45 .($self->part ? ("[".$self->part."]") : "");
46 }
47  
48 5 has_attr 'by_id' =>
49 is => "ro",
50 isa => "XML::SRS::RegistrarId",
51 required => 1,
52 xml_name => "OrigRegistrarId",
53 ;
54  
55 5 has_attr 'for_id' =>
56 is => "ro",
57 isa => "XML::SRS::RegistrarId",
58 xml_required => 0,
59 xml_name => "RecipientRegistrarId",
60 ;
61  
62 5 has_attr 'client_id' =>
63 is => "ro",
64 isa => "XML::SRS::UID",
65 xml_required => 0,
66 xml_name => "TransId",
67 ;
68  
69 5 has_attr 'rows' =>
70 is => "ro",
71 isa => "XML::SRS::Number",
72 xml_required => 0,
73 xml_name => "Rows",
74 ;
75  
76 5 has_attr 'has_more_rows' =>
77 is => "ro",
78 isa => "XML::SRS::Boolean",
79 coerce => 1,
80 xml_required => 0,
81 xml_name => "MoreRowsAvailable",
82 ;
83  
84 5 has_attr 'count' =>
85 is => "ro",
86 isa => "XML::SRS::Number",
87 xml_required => 0,
88 xml_name => "Count",
89 ;
90  
91 5 subtype 'XML::SRS::timeStampType'
92 => as "XML::SRS::TimeStamp",
93 ;
94  
95 coerce "XML::SRS::timeStampType"
96 => from TimestampTZ
97 0 ▶ => via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
98 0 XML::SRS::TimeStamp->new(timestamptz => $_);
99 5 };
100  
101 5 has_element 'server_time' =>
102 is => "ro",
103 isa => "XML::SRS::timeStampType",
104 coerce => 1,
105 xml_nodeName => "FeTimeStamp",
106 required => 1,
107 ;
108  
109 5 ▶use MooseX::Timestamp;
Subroutine BEGIN: called CC=1 SCAR=0.0
110 5 ▶use MooseX::TimestampTZ;
Subroutine BEGIN: called CC=1 SCAR=0.0
111  
112  
113  
114 # this is for GetMessages responses, so let's call it messages
115 5 has_element 'messages' =>
116 is => "ro",
117 isa => "ArrayRef[XML::SRS::Result]",
118 xml_nodeName => "Response",
119 xml_min => 0,
120 ;
121  
122 has_element 'responses' =>
123 is => "ro",
124 isa => "ArrayRef[XML::SRS::ActionResponse]",
125 xml_required => 0,
126 lazy => 1,
127 0 ▶ default => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
128 0 my $self = shift;
129 0 ▶ ($self->has_response and defined $self->response)
Branch: 1 branch
BranchTrueFalseTotal
$self->has_response && defined $self->response ? : 0 0 0
Condition0%0/3
$self->has_response and defined $self->response
!ll&&!rl&&r
000
MC/DC0%0/2
$self->has_response and defined $self->response
$self->has_response defined $self->response
Truth table0%0/3
A and B
A= $self->has_responseB= defined $self->response
ABresult
0X0
100
111
130 ? [ $self->response ] : [];
131 },
132 5 ;
133  
134 has 'response' =>
135 is => "ro",
136 isa => "Maybe[XML::SRS::ActionResponse]",
137 predicate => "has_response",
138 lazy => 1,
139 0 ▶ default => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
140 0 my $self = shift;
141 0 my $rs_a = $self->responses;
142 0 ▶ if ( $rs_a and @$rs_a ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rs_a and @$rs_a) { } 0 0 0
Condition0%0/3
$rs_a and @$rs_a
!ll&&!rl&&r
000
MC/DC0%0/2
$rs_a and @$rs_a
$rs_a @$rs_a
Truth table0%0/3
A and B
A= $rs_aB= @$rs_a
ABresult
0X0
100
111
143 0 ▶ if ( @$rs_a > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$rs_a > 1) { } 0 0 0
144 0 confess "result has multiple responses";
145 }
146 else {
147 0 $rs_a->[0];
148 }
149 }
150 else {
151 0 undef;
152 }
153 },
154 5 ;
155  
156 5 with 'XML::SRS::Node';
157  
158 5 1;
159  
160 __END__
« SRS/DS.pm ↑ Summary SRS/ACL.pm »