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 CC 8 SCAR 10.5
CC
8
Cov
88%
SEEK
5.4
FLUSH
4.0
BINMODE
2.0
CRAP 2.9
« Streaming.pm ↑ Summary
1 package Plack::App::CGIBin::Streaming::IO;
2  
3 36 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 36 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 36 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 36 ▶use Plack::App::CGIBin::Streaming;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 99 ▶sub PUSHED {
Subroutine PUSHED: called CC=1 SCAR=0.0
Pod undocumented
9 #my ($class, $mode, $fh) = @_;
10  
11 99 return bless +{read_mode => (substr($_[1], 0, 1) eq 'r')}, $_[0];
12 }
13  
14 83381 ▶sub WRITE {
Subroutine WRITE: called CC=1 SCAR=0.0
15 #my ($self, $buf, $fh) = @_;
16  
17 83381 $Plack::App::CGIBin::Streaming::R->print_content($_[1]);
18 83381 return length $_[1];
19 }
20  
21 115 ▶sub FLUSH {
Subroutine FLUSH: called CC=4 SCAR=13.9
Pod undocumented
22 #my ($self, $fh) = @_;
23  
24 115 ▶ return 0 if $_[0]->{in_flush} or $_[0]->{read_mode};
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"in_flush"} or $_[0]{"read_mode"} 36 79 115
Condition66%2/3
$_[0]{"in_flush"} or $_[0]{"read_mode"}
l!l&&r!l&&!r
03679
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 79 local $_[0]->{in_flush}=1;
26  
27 79 ▶ $Plack::App::CGIBin::Streaming::R->flush
Branch: 1 branch
BranchTrueFalseTotal
unless $Plack::App::CGIBin::Streaming::R->suppress_flush 10 69 79
28 unless $Plack::App::CGIBin::Streaming::R->suppress_flush;
29  
30 79 return 0;
31 }
32  
33 80123 ▶sub READ {
Subroutine READ: called CC=1 SCAR=0.0
34 #my ($self, $buf, $len, $fh) = @_;
35  
36 80123 return $_[3]->read($_[1], $_[2]);
37 }
38  
39 8 ▶sub SEEK {
Subroutine SEEK: called CC=4 SCAR=16.9
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'});
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 103 ▶sub BINMODE {
Subroutine BINMODE: called CC=2 SCAR=6.9
50 #my ($self, $fh) = @_;
51  
52 # pop the layer when we are done
53 103 ▶ return if $Plack::App::CGIBin::Streaming::R->binmode_ok;
Branch: 1 branch
BranchTrueFalseTotal
if $Plack::App::CGIBin::Streaming::R->binmode_ok 99 4 103
54  
55 # otherwise keep it
56 4 return 0;
57 }
58  
59 36 1;
60  
61 __END__
« Streaming.pm ↑ Summary