line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pipe::Tube::Cat; |
2
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
22
|
|
4
|
1
|
|
|
1
|
|
16
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use base 'Pipe::Tube'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
603
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub init { |
11
|
19
|
|
|
19
|
0
|
37
|
my ($self, @files) = @_; |
12
|
19
|
|
|
|
|
25
|
@{ $self->{files} } = @files; |
|
19
|
|
|
|
|
49
|
|
13
|
|
|
|
|
|
|
|
14
|
19
|
|
|
|
|
46
|
return $self; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# implement <> here |
18
|
|
|
|
|
|
|
sub run { |
19
|
128
|
|
|
128
|
0
|
204
|
my ($self, @files) = @_; |
20
|
|
|
|
|
|
|
|
21
|
128
|
|
|
|
|
146
|
push @{ $self->{files} }, @files; |
|
128
|
|
|
|
|
191
|
|
22
|
|
|
|
|
|
|
|
23
|
128
|
|
|
|
|
188
|
my $fh = $self->{fh}; |
24
|
128
|
|
|
|
|
148
|
while (1) { |
25
|
157
|
100
|
|
|
|
264
|
if (not defined $fh) { |
26
|
47
|
|
|
|
|
87
|
$fh = $self->_next_file; |
27
|
|
|
|
|
|
|
} |
28
|
157
|
100
|
|
|
|
322
|
return if not $fh; |
29
|
139
|
|
|
|
|
851
|
my $row = <$fh>; |
30
|
139
|
100
|
|
|
|
278
|
if (defined $row) { |
31
|
110
|
|
|
|
|
352
|
$self->logger("Row read: $row"); |
32
|
110
|
|
|
|
|
323
|
return $row; |
33
|
|
|
|
|
|
|
} else { |
34
|
29
|
|
|
|
|
56
|
$fh = undef; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _next_file { |
40
|
47
|
|
|
47
|
|
72
|
my ($self) = @_; |
41
|
47
|
|
|
|
|
60
|
while (my $file = shift @{ $self->{files} }) { |
|
48
|
|
|
|
|
191
|
|
42
|
30
|
|
|
|
|
94
|
$self->logger("Opening file '$file'"); |
43
|
30
|
100
|
|
|
|
1146
|
if (open my $fh, "<", $file) { |
44
|
29
|
|
|
|
|
282
|
return $self->{fh} = $fh; |
45
|
|
|
|
|
|
|
} else { |
46
|
1
|
|
|
|
|
21
|
warn "Could not open '$file'. $!\n"; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|