| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Stream::Buffered::Auto; |
|
2
|
2
|
|
|
2
|
|
21
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
111
|
|
|
3
|
2
|
|
|
2
|
|
119
|
use warnings; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
151
|
|
|
4
|
2
|
|
|
2
|
|
50
|
use base 'Stream::Buffered'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
1116
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
|
7
|
2
|
|
|
2
|
0
|
7
|
my($class, undef, $max_memory_size) = @_; |
|
8
|
2
|
|
|
|
|
15
|
bless { |
|
9
|
|
|
|
|
|
|
_buffer => Stream::Buffered->create('PerlIO'), |
|
10
|
|
|
|
|
|
|
_max => $max_memory_size, |
|
11
|
|
|
|
|
|
|
}, $class; |
|
12
|
|
|
|
|
|
|
} |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub print { |
|
15
|
10
|
|
|
10
|
0
|
27
|
my $self = shift; |
|
16
|
10
|
|
|
|
|
33
|
$self->{_buffer}->print(@_); |
|
17
|
|
|
|
|
|
|
|
|
18
|
10
|
100
|
66
|
|
|
50
|
if ($self->{_max} && $self->{_buffer}->size > $self->{_max}) { |
|
19
|
2
|
|
|
|
|
7
|
my $buf = $self->{_buffer}->{buffer}; |
|
20
|
2
|
|
|
|
|
10
|
$self->{_buffer} = Stream::Buffered->create('File'), |
|
21
|
|
|
|
|
|
|
$self->{_buffer}->print($buf); |
|
22
|
2
|
|
|
|
|
55
|
delete $self->{_max}; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub size { |
|
27
|
4
|
|
|
4
|
0
|
24
|
my $self = shift; |
|
28
|
4
|
|
|
|
|
25
|
$self->{_buffer}->size; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub rewind { |
|
32
|
2
|
|
|
2
|
0
|
4
|
my $self = shift; |
|
33
|
2
|
|
|
|
|
11
|
$self->{_buffer}->rewind; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |