line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pipe::Tube::Map; |
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
27
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use base 'Pipe::Tube'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
327
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub init { |
11
|
3
|
|
|
3
|
0
|
5
|
my ($self, $expr) = @_; |
12
|
3
|
|
|
|
|
19
|
$self->logger("Receiving the map expression: $expr"); |
13
|
3
|
|
|
|
|
7
|
$self->{expr} = $expr; |
14
|
3
|
|
|
|
|
10
|
return $self; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub run { |
18
|
16
|
|
|
16
|
0
|
36
|
my ($self, @input) = @_; |
19
|
|
|
|
|
|
|
|
20
|
16
|
|
|
|
|
62
|
$self->logger("The map expression: $self->{expr}"); |
21
|
16
|
50
|
|
|
|
46
|
if ("Regexp" eq ref $self->{expr}) { |
22
|
0
|
|
|
|
|
0
|
return map /$self->{expr}/, @input; |
23
|
|
|
|
|
|
|
} else { |
24
|
16
|
|
|
|
|
27
|
my $sub = $self->{expr}; |
25
|
16
|
|
|
|
|
30
|
return map { $sub->($_) } @input; |
|
15
|
|
|
|
|
46
|
|
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|