blib/lib/Plack/App/CGIBin/Streaming/IO.pm

filter: Statementstmt 100% 24 / 24 Branchbran 80.0% 8 / 10 Conditioncond 50.0% 3 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 2 totaltotal 82.1% 46 / 56 SCAR 20.9
CC
8
Cov
88%
SEEK
5.4
FLUSH
4.0
BINMODE
2.0
CRAP 8.1
« blib/lib/Plack/App/CGIBin/Streaming.pm ↑ Summary Build »
1 package Plack::App::CGIBin::Streaming::IO;
2  
3 33 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 33 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 33 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 33 ▶use Plack::App::CGIBin::Streaming;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub PUSHED {
9 #my ($class, $mode, $fh) = @_;
10  
11 96 ▶ return bless +{read_mode => (substr($_[1], 0, 1) eq 'r')}, $_[0];
Subroutine PUSHED: called CC=1 SCAR=0.0
Pod undocumented
12 }
13  
14 sub WRITE {
15 #my ($self, $buf, $fh) = @_;
16  
17 83381 ▶ $Plack::App::CGIBin::Streaming::R->print_content($_[1]);
Subroutine WRITE: called CC=1 SCAR=0.0
18 83381 return length $_[1];
19 }
20  
21 sub FLUSH {
22 #my ($self, $fh) = @_;
23  
24 112 ▶ return 0 if $_[0]->{in_flush} or $_[0]->{read_mode};
Subroutine FLUSH: called CC=4 SCAR=13.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"in_flush"} or $_[0]{"read_mode"} 35 77 112
Condition66%2/3
$_[0]{"in_flush"} or $_[0]{"read_mode"}
l!l&&r!l&&!r
03577
MC/DC50%1/2
$_[0]{"in_flush"} or $_[0]{"read_mode"}
$_[0]{"in_flush"} $_[0]{"read_mode"}
Truth table66%2/3
A or B
A= $_[0]{"in_flush"}B= $_[0]{"read_mode"}
ABresult
1X1
011
000
25 77 local $_[0]->{in_flush}=1;
26  
27 77 ▶ $Plack::App::CGIBin::Streaming::R->flush
Branch: 1 branch
BranchTrueFalseTotal
unless $Plack::App::CGIBin::Streaming::R->suppress_flush 10 67 77
28 unless $Plack::App::CGIBin::Streaming::R->suppress_flush;
29  
30 77 return 0;
31 }
32  
33 sub READ {
34 #my ($self, $buf, $len, $fh) = @_;
35  
36 80123 ▶ return $_[3]->read($_[1], $_[2]);
Subroutine READ: called CC=1 SCAR=0.0
37 }
38  
39 sub SEEK {
40 #my ($self, $pos, $whence, $fh) = @_;
41  
42 return -1
43 unless ($_[0]->{read_mode} and
44 8 ▶ $Plack::App::CGIBin::Streaming::R->env->{'psgix.input.buffered'});
Subroutine SEEK: called CC=4 SCAR=16.9
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0]{"read_mode"} and $Plack::App::CGIBin::Streaming::R->env->{"psgix.input.buffered"} 0 8 8
Condition33%1/3
$_[0]{"read_mode"} and $Plack::App::CGIBin::Streaming::R->env->{"psgix.input.buffered"}
!ll&&!rl&&r
008
MC/DC0%0/2
$_[0]{"read_mode"} and $Plack::App::CGIBin::Streaming::R->env->{"psgix.input.buffered"}
$_[0]{"read_mode"} $Plack::App::CGIBin::Streaming::R->env->{"psgix.input.buffered"}
Truth table33%1/3
A and B
A= $_[0]{"read_mode"}B= $Plack::App::CGIBin::Streaming::R->env->{"psgix.input.buffered"}
ABresult
0X0
100
111
45  
46 8 ▶ return $_[3]->seek($_[1], $_[2]) ? 0 : -1;
Branch: 1 branch
BranchTrueFalseTotal
$_[3]->seek($_[1], $_[2]) ? : 8 0 8
47 }
48  
49 sub BINMODE {
50 #my ($self, $fh) = @_;
51  
52 # pop the layer when we are done
53 100 ▶ return if $Plack::App::CGIBin::Streaming::R->binmode_ok;
Subroutine BINMODE: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if $Plack::App::CGIBin::Streaming::R->binmode_ok 96 4 100
54  
55 # otherwise keep it
56 4 return 0;
57 }
58  
59 33 1;
60  
61 __END__
« blib/lib/Plack/App/CGIBin/Streaming.pm ↑ Summary Build »