line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pipe::Tube::Split; |
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
21
|
use 5.006; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
45
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use base 'Pipe::Tube'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
266
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub init { |
11
|
3
|
|
|
3
|
0
|
5
|
my ($self, $expr) = @_; |
12
|
3
|
|
|
|
|
15
|
$self->logger("Receiving the split expression: $expr"); |
13
|
3
|
100
|
|
|
|
16
|
if ("Regexp" eq ref $expr) { |
|
|
50
|
|
|
|
|
|
14
|
1
|
|
|
|
|
2
|
$self->{expr} = $expr; |
15
|
|
|
|
|
|
|
} elsif (not ref $expr) { |
16
|
2
|
|
|
|
|
37
|
$self->{expr} = qr/\Q$expr/; |
17
|
|
|
|
|
|
|
} else { |
18
|
0
|
|
|
|
|
0
|
die "Unrecognized type of parameter for split\n"; |
19
|
|
|
|
|
|
|
} |
20
|
3
|
|
|
|
|
10
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub run { |
24
|
12
|
|
|
12
|
0
|
19
|
my ($self, @input) = @_; |
25
|
|
|
|
|
|
|
|
26
|
12
|
|
|
|
|
38
|
$self->logger("The grep expression: $self->{expr}"); |
27
|
12
|
|
|
|
|
23
|
return map { [ split /$self->{expr}/, $_ ] } @input; |
|
6
|
|
|
|
|
51
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|