Engine/Role/ResponseWriter/OutputBody.pm untested

filter: Statementstmt 0.0% 0 / 15 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 29 SCAR 24.8
CC
3
Cov
0%
output_body
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 12.0
1 package HTTP::Engine::Role::ResponseWriter::OutputBody;
2 use Any::Moose '::Role';
3  
4 has chunk_size => (
5 is => 'ro',
6 isa => 'Int',
7 default => 4096,
8 );
9  
10 sub output_body {
11 my($self, $body) = @_;
12  
13 no warnings 'uninitialized';
14 if ((Scalar::Util::blessed($body) && $body->can('read')) || (ref($body) eq 'GLOB')) {
15 while (!eof $body) {
16 read $body, my ($buffer), $self->chunk_size;
17 last unless $self->write($buffer);
18 }
19 close $body;
20 } else {
21 $self->write($body);
22 }
23 }
24  
25 1;