line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::App::CGIBin::Streaming::IO; |
2
|
|
|
|
|
|
|
|
3
|
36
|
|
|
36
|
|
684
|
use 5.014; |
|
36
|
|
|
|
|
123
|
|
|
36
|
|
|
|
|
1248
|
|
4
|
36
|
|
|
36
|
|
186
|
use strict; |
|
36
|
|
|
|
|
63
|
|
|
36
|
|
|
|
|
963
|
|
5
|
36
|
|
|
36
|
|
183
|
use warnings; |
|
36
|
|
|
|
|
60
|
|
|
36
|
|
|
|
|
1164
|
|
6
|
36
|
|
|
36
|
|
216
|
use Plack::App::CGIBin::Streaming; |
|
36
|
|
|
|
|
60
|
|
|
36
|
|
|
|
|
11478
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub PUSHED { |
9
|
|
|
|
|
|
|
#my ($class, $mode, $fh) = @_; |
10
|
|
|
|
|
|
|
|
11
|
99
|
|
|
99
|
0
|
29309
|
return bless +{read_mode => (substr($_[1], 0, 1) eq 'r')}, $_[0]; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub WRITE { |
15
|
|
|
|
|
|
|
#my ($self, $buf, $fh) = @_; |
16
|
|
|
|
|
|
|
|
17
|
83381
|
|
|
83381
|
|
883962
|
$Plack::App::CGIBin::Streaming::R->print_content($_[1]); |
18
|
83381
|
|
|
|
|
345672
|
return length $_[1]; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub FLUSH { |
22
|
|
|
|
|
|
|
#my ($self, $fh) = @_; |
23
|
|
|
|
|
|
|
|
24
|
115
|
100
|
66
|
115
|
0
|
3341
|
return 0 if $_[0]->{in_flush} or $_[0]->{read_mode}; |
25
|
79
|
|
|
|
|
213
|
local $_[0]->{in_flush}=1; |
26
|
|
|
|
|
|
|
|
27
|
79
|
100
|
|
|
|
260
|
$Plack::App::CGIBin::Streaming::R->flush |
28
|
|
|
|
|
|
|
unless $Plack::App::CGIBin::Streaming::R->suppress_flush; |
29
|
|
|
|
|
|
|
|
30
|
79
|
|
|
|
|
386
|
return 0; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub READ { |
34
|
|
|
|
|
|
|
#my ($self, $buf, $len, $fh) = @_; |
35
|
|
|
|
|
|
|
|
36
|
80123
|
|
|
80123
|
|
232975
|
return $_[3]->read($_[1], $_[2]); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub SEEK { |
40
|
|
|
|
|
|
|
#my ($self, $pos, $whence, $fh) = @_; |
41
|
|
|
|
|
|
|
|
42
|
8
|
50
|
33
|
8
|
|
95
|
return -1 |
43
|
|
|
|
|
|
|
unless ($_[0]->{read_mode} and |
44
|
|
|
|
|
|
|
$Plack::App::CGIBin::Streaming::R->env->{'psgix.input.buffered'}); |
45
|
|
|
|
|
|
|
|
46
|
8
|
50
|
|
|
|
70
|
return $_[3]->seek($_[1], $_[2]) ? 0 : -1; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub BINMODE { |
50
|
|
|
|
|
|
|
#my ($self, $fh) = @_; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# pop the layer when we are done |
53
|
103
|
100
|
|
103
|
|
490
|
return if $Plack::App::CGIBin::Streaming::R->binmode_ok; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# otherwise keep it |
56
|
4
|
|
|
|
|
34
|
return 0; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |