line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pipe::Tube::Tuple; |
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
41
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
30
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use base 'Pipe::Tube'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
412
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub init { |
11
|
2
|
|
|
2
|
0
|
5
|
my ($self, @arrays) = @_; |
12
|
2
|
|
|
|
|
4
|
$self->{sources} = \@arrays; |
13
|
2
|
|
|
|
|
5
|
$self->{current_index} = 0; |
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
|
|
3
|
my $l = 0; |
16
|
2
|
50
|
|
|
|
9
|
$l = ($l > @$_ ? $l : @$_) for @arrays; |
17
|
2
|
|
|
|
|
5
|
$self->{longest_array} = $l; |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
|
|
12
|
$self->logger("The tuple received " . @arrays . " sources"); |
20
|
2
|
|
|
|
|
7
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub run { |
24
|
10
|
|
|
10
|
0
|
12
|
my ($self) = @_; |
25
|
|
|
|
|
|
|
|
26
|
10
|
100
|
|
|
|
28
|
return if $self->{current_index} >= $self->{longest_array}; |
27
|
|
|
|
|
|
|
|
28
|
8
|
|
|
|
|
8
|
my @tuple; |
29
|
8
|
|
|
|
|
10
|
foreach my $source (@{ $self->{sources} }) { |
|
8
|
|
|
|
|
16
|
|
30
|
12
|
|
|
|
|
24
|
push @tuple, $source->[ $self->{current_index} ]; |
31
|
|
|
|
|
|
|
} |
32
|
8
|
|
|
|
|
13
|
$self->{current_index}++; |
33
|
8
|
|
|
|
|
24
|
return \@tuple; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|