| 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
Condition66%2/3
$_[0]{"in_flush"} or $_[0]{"read_mode"}
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"}
| |||||||||||||||||||||||||||||
| 25 | 79 | local $_[0]->{in_flush}=1; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 79 | ▶ | $Plack::App::CGIBin::Streaming::R->flush | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
$_[0]{"read_mode"} and $Plack::App::CGIBin::Streaming::R->env->{"psgix.input.buffered"}
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"}
| |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 8 | ▶ | return $_[3]->seek($_[1], $_[2]) ? 0 : -1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | # otherwise keep it | ||||||||||||||||||||||||||||
| 56 | 4 | return 0; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 36 | 1; | |||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | __END__ | ||||||||||||||||||||||||||||