HTTP/Transaction.pm

filter: Statementstmt 96.5% 166 / 172 Branchbran 63.0% 82 / 130 Conditioncond 52.9% 9 / 17 MC/DCmcdc 27.2% 3 / 11 Subroutinesub 95.0% 38 / 40 Podpod 100% 16 / 16 totaltotal 81.3% 314 / 386 CC 72 SCAR 18.7
CC
72
Cov
81%
_set_controller
30.0
_write_body
11.2
upgrade
8.3
CRAP 6.5
« HTTP/Client/Operation.pm ↑ Summary HTTP/Request.pm »
1 package Linux::Event::HTTP::Transaction;
2 35 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 35 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 35 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 35 ▶use Scalar::Util qw(blessed weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 35 our $VERSION = '0.003';
9  
10 35 my %TERMINAL = map { $_ => 1 } qw(complete cancelled error);
11  
12 87 ▶sub _new ($class, %args) {
Subroutine _new: called CC=7 SCAR=19.5
13 87 my $request = delete $args{request};
14 87 my $controller = delete $args{controller};
15  
16 87 ▶ die 'Transaction requires a Linux::Event::HTTP::Request'
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($request) and $request->isa("Linux::Event::HTTP::Request") 1 86 87
Condition66%2/3
builtin::blessed($request) and $request->isa("Linux::Event::HTTP::Request")
!ll&&!rl&&r
0186
MC/DC50%1/2
builtin::blessed($request) and $request->isa("Linux::Event::HTTP::Request")
builtin::blessed($request) $request->isa("Linux::Event::HTTP::Request")
Truth table66%2/3
A and B
A= builtin::blessed($request)B= $request->isa("Linux::Event::HTTP::Request")
ABresult
0X0
100
111
17 if !blessed($request)
18 || !$request->isa('Linux::Event::HTTP::Request');
19 86 ▶ die 'Transaction controller must be an object'
Branch: 1 branch
BranchTrueFalseTotal
if defined $controller and not builtin::blessed($controller) 1 85 86
Condition100%3/3
defined $controller and not builtin::blessed($controller)
!ll&&!rl&&r
2831
MC/DC100%2/2
defined $controller and not builtin::blessed($controller)
defined $controller not builtin::blessed($controller)
Truth table100%3/3
A and not(B)
A= defined $controllerB= not builtin::blessed($controller)
ABresult
0X0
100
111
20 if defined($controller) && !blessed($controller);
21 85 ▶ die 'unknown Transaction option: ' . join(', ', sort keys %args)
Branch: 1 branch
BranchTrueFalseTotal
if %args 0 85 85
22 if %args;
23  
24 85 my $self = bless {
25 request => $request,
26 request_body => undef,
27 response => undef,
28 response_body => undef,
29 response_output_started => 0,
30 response_output_complete => 0,
31 upgrade_pending => 0,
32 tunnel_pending => 0,
33 state => 'pending',
34 error => undef,
35 controller => $controller,
36 }, $class;
37 85 ▶ weaken($self->{controller}) if defined $self->{controller};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"controller"} 83 2 85
38 85 return $self;
39 }
40  
41 31 ▶sub _new_server_active ($class, $request, $response, $controller) {
Subroutine _new_server_active: called CC=1 SCAR=0.0
42 31 my $self = bless {
43 request => $request,
44 response => $response,
45 state => 'active',
46 controller => $controller,
47 }, $class;
48 31 weaken($self->{controller});
49 31 return $self;
50 }
51  
52 227 ▶sub request ($self) { $self->{request} }
Subroutine request: called CC=1 SCAR=0.0
Pod documented
53 334 ▶sub response ($self) { $self->{response} }
Subroutine response: called CC=1 SCAR=0.0
Pod documented
54 13 ▶sub state ($self) { $self->{state} }
Subroutine state: called CC=1 SCAR=0.0
Pod documented
55 2 ▶sub error ($self) { $self->{error} }
Subroutine error: called CC=1 SCAR=0.0
Pod documented
56 76 ▶sub is_complete ($self) { $self->{state} eq 'complete' }
Subroutine is_complete: called CC=1 SCAR=0.0
Pod documented
57 37 ▶sub is_cancelled ($self) { $self->{state} eq 'cancelled' }
Subroutine is_cancelled: called CC=1 SCAR=0.0
Pod documented
58 537 ▶sub is_terminal ($self) { !!$TERMINAL{$self->{state}} }
Subroutine is_terminal: called CC=1 SCAR=0.0
Pod documented
59 27 ▶sub is_response_started ($self) { !!$self->{response_output_started} }
Subroutine is_response_started: called CC=1 SCAR=0.0
Pod documented
60 22 ▶sub is_upgrading ($self) { !!$self->{upgrade_pending} }
Subroutine is_upgrading: called CC=1 SCAR=0.0
Pod documented
61 18 ▶sub is_tunneling ($self) { !!$self->{tunnel_pending} }
Subroutine is_tunneling: called CC=1 SCAR=0.0
Pod documented
62  
63 15 ▶sub request_body ($self, @args) {
Subroutine request_body: called CC=6 SCAR=18.3
Pod documented
64 15 ▶ die 'request_body(): Transaction is already terminal'
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 0 15 15
65 if $self->is_terminal;
66 15 my $request = $self->{request};
67  
68 15 ▶ if (my $body = $self->{request_body}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $body = $self->{"request_body"}) 8 7 15
69 8 ▶ die 'request_body options may only be supplied when the producer is created'
Branch: 1 branch
BranchTrueFalseTotal
if @args 0 8 8
70 if @args;
71 8 return $body;
72 }
73  
74 7 ▶ die 'request_body(): Request is not configured for incremental body production'
Branch: 1 branch
BranchTrueFalseTotal
unless $request->_has_incremental_body 0 7 7
75 if !$request->_has_incremental_body;
76 7 ▶ die 'request_body options must be key/value pairs' if @args % 2;
Branch: 1 branch
BranchTrueFalseTotal
if @args % 2 0 7 7
77  
78 7 require Linux::Event::HTTP::Body::Stream;
79 7 my $body = Linux::Event::HTTP::Body::Stream->_new(
80 $self, 'request', @args,
81 );
82 7 $self->{request_body} = $body;
83 7 return $body;
84 }
85  
86 18 ▶sub response_body ($self, @args) {
Subroutine response_body: called CC=7 SCAR=19.8
Pod documented
87 18 ▶ die 'response_body(): Transaction is already terminal'
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 0 18 18
88 if $self->is_terminal;
89 my $response = $self->{response}
90 18 ▶ or die 'response_body(): Transaction has no Response yet';
Branch: 1 branch
BranchTrueFalseTotal
my $response = $self->{"response"} or die "response_body(): Transaction has no Response yet" 18 0 18
91  
92 18 ▶ if (my $body = $self->{response_body}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $body = $self->{"response_body"}) 3 15 18
93 3 ▶ die 'response_body options may only be supplied when the producer is created'
Branch: 1 branch
BranchTrueFalseTotal
if @args 1 2 3
94 if @args;
95 2 return $body;
96 }
97  
98 die 'response_body(): response output has already started'
99 15 ▶ if $self->{response_output_started};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"response_output_started"} 0 15 15
100 15 ▶ die 'response_body options must be key/value pairs' if @args % 2;
Branch: 1 branch
BranchTrueFalseTotal
if @args % 2 0 15 15
101  
102 15 require Linux::Event::HTTP::Body::Stream;
103 15 my $body = Linux::Event::HTTP::Body::Stream->_new(
104 $self, 'response', @args,
105 );
106  
107 13 $response->_begin_stream_body;
108 12 $self->{response_body} = $body;
109 12 return $body;
110 }
111  
112 2 ▶sub send_response ($self) {
Subroutine send_response: called CC=6 SCAR=19.3
Pod documented
113 2 ▶ die 'send_response(): Transaction is already terminal'
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 0 2 2
114 if $self->is_terminal;
115 die 'send_response(): response output has already started'
116 2 ▶ if $self->{response_output_started};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"response_output_started"} 0 2 2
117  
118 my $response = $self->{response}
119 2 ▶ or die 'send_response(): Transaction has no Response yet';
Branch: 1 branch
BranchTrueFalseTotal
my $response = $self->{"response"} or die "send_response(): Transaction has no Response yet" 2 0 2
120 2 ▶ die 'send_response(): Response does not have a complete scalar body'
Branch: 1 branch
BranchTrueFalseTotal
unless $response->_has_scalar_body 0 2 2
121 if !$response->_has_scalar_body;
122  
123 my $controller = $self->{controller}
124 2 ▶ or die 'send_response(): Transaction has no active controller';
Branch: 1 branch
BranchTrueFalseTotal
my $controller = $self->{"controller"} or die "send_response(): Transaction has no active controller" 2 0 2
125 2 $controller->_send_http_response($self);
126 2 return $self;
127 }
128  
129 4 ▶sub upgrade ($self, $target_class) {
Subroutine upgrade: called CC=7 SCAR=21.2
Pod documented
130 4 ▶ die 'upgrade(): Transaction is already terminal'
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 0 4 4
131 if $self->is_terminal;
132 die 'upgrade(): response output has already started'
133 4 ▶ if $self->{response_output_started};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"response_output_started"} 0 4 4
134 die 'upgrade(): Transaction already has an Upgrade handoff pending'
135 4 ▶ if $self->{upgrade_pending};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"upgrade_pending"} 0 4 4
136 die 'upgrade(): Transaction already has a CONNECT tunnel handoff pending'
137 4 ▶ if $self->{tunnel_pending};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"tunnel_pending"} 0 4 4
138  
139 my $response = $self->{response}
140 4 ▶ or die 'upgrade(): Transaction has no Response yet';
Branch: 1 branch
BranchTrueFalseTotal
my $response = $self->{"response"} or die "upgrade(): Transaction has no Response yet" 4 0 4
141 my $controller = $self->{controller}
142 4 ▶ or die 'upgrade(): Transaction has no active controller';
Branch: 1 branch
BranchTrueFalseTotal
my $controller = $self->{"controller"} or die "upgrade(): Transaction has no active controller" 4 0 4
143  
144 4 $controller->_upgrade_http_transaction($self, $target_class);
145 2 return $self;
146 }
147  
148 13 ▶sub tunnel ($self, $target_class) {
Subroutine tunnel: called CC=7 SCAR=21.2
Pod documented
149 13 ▶ die 'tunnel(): Transaction is already terminal'
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 0 13 13
150 if $self->is_terminal;
151 die 'tunnel(): response output has already started'
152 13 ▶ if $self->{response_output_started};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"response_output_started"} 0 13 13
153 die 'tunnel(): Transaction already has an Upgrade handoff pending'
154 13 ▶ if $self->{upgrade_pending};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"upgrade_pending"} 0 13 13
155 die 'tunnel(): Transaction already has a CONNECT tunnel handoff pending'
156 13 ▶ if $self->{tunnel_pending};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"tunnel_pending"} 0 13 13
157  
158 my $response = $self->{response}
159 13 ▶ or die 'tunnel(): Transaction has no Response yet';
Branch: 1 branch
BranchTrueFalseTotal
my $response = $self->{"response"} or die "tunnel(): Transaction has no Response yet" 13 0 13
160 my $controller = $self->{controller}
161 13 ▶ or die 'tunnel(): Transaction has no active controller';
Branch: 1 branch
BranchTrueFalseTotal
my $controller = $self->{"controller"} or die "tunnel(): Transaction has no active controller" 13 0 13
162  
163 13 $controller->_tunnel_http_transaction($self, $target_class);
164 2 return $self;
165 }
166  
167 6 ▶sub cancel ($self) {
Subroutine cancel: called CC=4 SCAR=13.9
Pod documented
168 6 ▶ return $self if $self->is_terminal;
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 2 4 6
169  
170 4 ▶ if (my $controller = $self->{controller}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $controller = $self->{"controller"}) 4 0 4
171 4 $controller->_cancel_http_transaction($self);
172 }
173  
174 4 ▶ return $self if $self->is_terminal;
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 3 1 4
175 1 return $self->_mark_cancelled;
176 }
177  
178 0 ▶sub _set_controller ($self, $controller) {
Subroutine _set_controller: not called CC=5 SCAR=34.0
179 0 ▶ die 'cannot change controller of a terminal Transaction'
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 0 0 0
180 if $self->is_terminal;
181 0 ▶ die 'Transaction controller must be an object'
Branch: 1 branch
BranchTrueFalseTotal
if defined $controller and not builtin::blessed($controller) 0 0 0
Condition0%0/3
defined $controller and not builtin::blessed($controller)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $controller and not builtin::blessed($controller)
defined $controller not builtin::blessed($controller)
Truth table0%0/3
A and not(B)
A= defined $controllerB= not builtin::blessed($controller)
ABresult
0X0
100
111
182 if defined($controller) && !blessed($controller);
183  
184 0 $self->{controller} = $controller;
185 0 ▶ weaken($self->{controller}) if defined $self->{controller};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"controller"} 0 0 0
186 0 return $self;
187 }
188  
189 82 ▶sub _activate ($self) {
Subroutine _activate: called CC=2 SCAR=7.1
190 82 ▶ die 'cannot activate a terminal Transaction' if $self->is_terminal;
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 0 82 82
191 82 $self->{state} = 'active';
192 82 return $self;
193 }
194  
195 78 ▶sub _set_response ($self, $response) {
Subroutine _set_response: called CC=6 SCAR=18.7
196 78 ▶ die 'cannot attach a Response to a terminal Transaction'
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 0 78 78
197 if $self->is_terminal;
198 78 ▶ die 'Transaction already has a Response' if $self->{response};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"response"} 1 77 78
199 77 ▶ die 'Transaction response must be a Linux::Event::HTTP::Response'
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($response) and $response->isa("Linux::Event::HTTP::Response") 0 77 77
Condition33%1/3
builtin::blessed($response) and $response->isa("Linux::Event::HTTP::Response")
!ll&&!rl&&r
0077
MC/DC0%0/2
builtin::blessed($response) and $response->isa("Linux::Event::HTTP::Response")
builtin::blessed($response) $response->isa("Linux::Event::HTTP::Response")
Truth table33%1/3
A and B
A= builtin::blessed($response)B= $response->isa("Linux::Event::HTTP::Response")
ABresult
0X0
100
111
200 if !blessed($response)
201 || !$response->isa('Linux::Event::HTTP::Response');
202  
203 77 $self->{response} = $response;
204 77 ▶ $self->{state} = 'active' if $self->{state} eq 'pending';
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"state"} eq "pending" 6 71 77
205 77 return $response;
206 }
207  
208 31 ▶sub _write_body ($self, $kind, $bytes, $final, $operation) {
Subroutine _write_body: called CC=11 SCAR=24.2
209 31 ▶ die "$operation(): Transaction is already terminal"
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 0 31 31
210 if $self->is_terminal;
211 31 ▶ die "$operation(): unsupported HTTP body producer '$kind'"
Branch: 1 branch
BranchTrueFalseTotal
if $kind ne "request" and $kind ne "response" 0 31 31
Condition66%2/3
$kind ne "request" and $kind ne "response"
!ll&&!rl&&r
9220
MC/DC0%0/2
$kind ne "request" and $kind ne "response"
$kind ne "request" $kind ne "response"
Truth table66%2/3
A and B
A= $kind ne "request"B= $kind ne "response"
ABresult
0X0
100
111
212 if $kind ne 'request' && $kind ne 'response';
213  
214 my $message = $kind eq 'request'
215 ? $self->{request}
216 : ($self->{response}
217 31 ▶ or die "$operation(): Transaction has no Response");
Branch: 1 branch
BranchTrueFalseTotal
$kind eq 'request' ? : 9 22 31
Condition50%1/2
$self->{"response"} or die "$operation(): Transaction has no Response"
l!l
220
MC/DC0%0/1
$self->{"response"} or die "$operation(): Transaction has no Response"
$self->{"response"}
Truth table50%1/2
A
A= $self->{"response"}
Aresult
11
00
218 my $controller = $self->{controller}
219 31 ▶ or die "$operation(): Transaction has no active controller";
Branch: 1 branch
BranchTrueFalseTotal
my $controller = $self->{"controller"} or die "$operation(): Transaction has no active controller" 31 0 31
220  
221 31 ▶ if ($final) {
Branch: 1 branch
BranchTrueFalseTotal
if ($final) 14 17 31
222 14 $message->_mark_complete;
223 }
224  
225 31 my ($accepted, $ok, $error);
226 {
227 31 local $@;
228 31 $ok = eval {
229 31 ▶ if ($kind eq 'request') {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq 'request') { } 9 22 31
230 9 $accepted = $controller->_write_http_request_body(
231 $self, $bytes, $final, $operation,
232 );
233 } else {
234 22 $accepted = $controller->_write_http_response_body(
235 $self, $bytes, $final, $operation,
236 );
237 }
238 29 1;
239 };
240 31 $error = $@;
241 }
242  
243 31 ▶ if (!$ok) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ok) 2 29 31
244 2 ▶ $message->_mark_incomplete if $final;
Branch: 1 branch
BranchTrueFalseTotal
if $final 1 1 2
245 2 die $error;
246 }
247  
248 29 return $accepted;
249 }
250  
251 10 ▶sub _request_body_object ($self) {
Subroutine _request_body_object: called CC=1 SCAR=0.0
252 10 return $self->{request_body};
253 }
254  
255 1 ▶sub _response_body_object ($self) {
Subroutine _response_body_object: called CC=1 SCAR=0.0
256 1 return $self->{response_body};
257 }
258  
259 17 ▶sub _is_response_output_complete ($self) {
Subroutine _is_response_output_complete: called CC=1 SCAR=0.0
260 17 return !!$self->{response_output_complete};
261 }
262  
263 16 ▶sub _mark_response_started ($self) {
Subroutine _mark_response_started: called CC=1 SCAR=0.0
264 16 $self->{response_output_started} = 1;
265 16 return $self;
266 }
267  
268 16 ▶sub _mark_response_output_complete ($self) {
Subroutine _mark_response_output_complete: called CC=1 SCAR=0.0
269 16 $self->{response_output_started} = 1;
270 16 $self->{response_output_complete} = 1;
271 16 return $self;
272 }
273  
274 2 ▶sub _set_upgrade_pending ($self) {
Subroutine _set_upgrade_pending: called CC=3 SCAR=11.4
275 2 ▶ die 'cannot schedule Upgrade on a terminal Transaction'
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 0 2 2
276 if $self->is_terminal;
277 die 'cannot schedule Upgrade while CONNECT tunnel handoff is pending'
278 2 ▶ if $self->{tunnel_pending};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"tunnel_pending"} 0 2 2
279 2 $self->{upgrade_pending} = 1;
280 2 return $self;
281 }
282  
283 2 ▶sub _clear_upgrade_pending ($self) {
Subroutine _clear_upgrade_pending: called CC=1 SCAR=0.0
284 2 $self->{upgrade_pending} = 0;
285 2 return $self;
286 }
287  
288 2 ▶sub _set_tunnel_pending ($self) {
Subroutine _set_tunnel_pending: called CC=3 SCAR=11.4
289 2 ▶ die 'cannot schedule CONNECT tunnel on a terminal Transaction'
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 0 2 2
290 if $self->is_terminal;
291 die 'cannot schedule CONNECT tunnel while Upgrade handoff is pending'
292 2 ▶ if $self->{upgrade_pending};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"upgrade_pending"} 0 2 2
293 2 $self->{tunnel_pending} = 1;
294 2 return $self;
295 }
296  
297 2 ▶sub _clear_tunnel_pending ($self) {
Subroutine _clear_tunnel_pending: called CC=1 SCAR=0.0
298 2 $self->{tunnel_pending} = 0;
299 2 return $self;
300 }
301  
302 26 ▶sub _cancel_body_producers ($self) {
Subroutine _cancel_body_producers: called CC=3 SCAR=11.0
303 26 ▶ if (my $body = $self->{request_body}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $body = $self->{"request_body"}) 2 24 26
304 2 $body->_cancel;
305 }
306 26 ▶ if (my $body = $self->{response_body}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $body = $self->{"response_body"}) 2 24 26
307 2 $body->_cancel;
308 }
309 26 return;
310 }
311  
312 84 ▶sub _mark_complete ($self) {
Subroutine _mark_complete: called CC=5 SCAR=16.1
313 84 ▶ die 'cannot complete a terminal Transaction' if $self->is_terminal;
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 0 84 84
314 die 'cannot complete a Transaction before it has a Response'
315 84 ▶ if !$self->{response};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"response"} 1 83 84
316  
317 83 ▶ if (my $body = $self->{request_body}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $body = $self->{"request_body"}) 5 78 83
318 5 ▶ $body->_cancel if !$body->is_complete;
Branch: 1 branch
BranchTrueFalseTotal
unless $body->is_complete 1 4 5
319 }
320 83 $self->{upgrade_pending} = 0;
321 83 $self->{tunnel_pending} = 0;
322 83 $self->{state} = 'complete';
323 83 delete $self->{controller};
324 83 return $self;
325 }
326  
327 6 ▶sub _mark_cancelled ($self) {
Subroutine _mark_cancelled: called CC=3 SCAR=11.1
328 6 ▶ return $self if $self->{state} eq 'cancelled';
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"state"} eq "cancelled" 0 6 6
329 6 ▶ die 'cannot cancel a terminal Transaction' if $self->is_terminal;
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 0 6 6
330  
331 6 $self->_cancel_body_producers;
332 6 $self->{upgrade_pending} = 0;
333 6 $self->{tunnel_pending} = 0;
334 6 $self->{state} = 'cancelled';
335 6 delete $self->{controller};
336 6 return $self;
337 }
338  
339 20 ▶sub _fail ($self, $error) {
Subroutine _fail: called CC=3 SCAR=11.1
340 20 ▶ die 'cannot fail a terminal Transaction' if $self->is_terminal;
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_terminal 0 20 20
341 20 ▶ die 'Transaction error must be defined' if !defined $error;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $error 0 20 20
342  
343 20 $self->_cancel_body_producers;
344 20 $self->{upgrade_pending} = 0;
345 20 $self->{tunnel_pending} = 0;
346 20 $self->{error} = $error;
347 20 $self->{state} = 'error';
348 20 delete $self->{controller};
349 20 return $self;
350 }
351  
352 0 ▶sub CLONE_SKIP { 1 }
Subroutine CLONE_SKIP: not called CC=1 SCAR=6.9
353  
354 35 1;
355  
356 __END__
« HTTP/Client/Operation.pm ↑ Summary HTTP/Request.pm »