line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pipe::Tube::Cat; |
2
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
41
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
4
|
1
|
|
|
1
|
|
34
|
use 5.006; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use base 'Pipe::Tube'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
769
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub init { |
11
|
19
|
|
|
19
|
0
|
38
|
my ($self, @files) = @_; |
12
|
19
|
|
|
|
|
24
|
@{ $self->{files} } = @files; |
|
19
|
|
|
|
|
96
|
|
13
|
|
|
|
|
|
|
|
14
|
19
|
|
|
|
|
60
|
return $self; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# implement <> here |
18
|
|
|
|
|
|
|
sub run { |
19
|
128
|
|
|
128
|
0
|
176
|
my ($self, @files) = @_; |
20
|
|
|
|
|
|
|
|
21
|
128
|
|
|
|
|
141
|
push @{ $self->{files} }, @files; |
|
128
|
|
|
|
|
244
|
|
22
|
|
|
|
|
|
|
|
23
|
128
|
|
|
|
|
230
|
my $fh = $self->{fh}; |
24
|
128
|
|
|
|
|
152
|
while (1) { |
25
|
157
|
100
|
|
|
|
361
|
if (not defined $fh) { |
26
|
47
|
|
|
|
|
165
|
$fh = $self->_next_file; |
27
|
|
|
|
|
|
|
} |
28
|
157
|
100
|
|
|
|
556
|
return if not $fh; |
29
|
139
|
|
|
|
|
728
|
my $row = <$fh>; |
30
|
139
|
100
|
|
|
|
238
|
if (defined $row) { |
31
|
110
|
|
|
|
|
398
|
$self->logger("Row read: $row"); |
32
|
110
|
|
|
|
|
381
|
return $row; |
33
|
|
|
|
|
|
|
} else { |
34
|
29
|
|
|
|
|
49
|
$fh = undef; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _next_file { |
40
|
47
|
|
|
47
|
|
60
|
my ($self) = @_; |
41
|
47
|
|
|
|
|
50
|
while (my $file = shift @{ $self->{files} }) { |
|
48
|
|
|
|
|
233
|
|
42
|
30
|
|
|
|
|
108
|
$self->logger("Opening file '$file'"); |
43
|
30
|
100
|
|
|
|
1293
|
if (open my $fh, "<", $file) { |
44
|
29
|
|
|
|
|
105
|
return $self->{fh} = $fh; |
45
|
|
|
|
|
|
|
} else { |
46
|
1
|
|
|
|
|
13
|
warn "Could not open '$file'. $!\n"; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|