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