line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Enumerator::Mapper; |
2
|
3
|
|
|
3
|
|
20
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
132
|
|
3
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
131
|
|
4
|
3
|
|
|
3
|
|
18
|
use List::MoreUtils qw/zip/; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
381
|
|
5
|
3
|
|
|
3
|
|
18
|
use base qw/Data::Enumerator::Base/; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
1184
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub iterator { |
8
|
6
|
|
|
6
|
0
|
11
|
my ( $self ) = @_; |
9
|
6
|
|
|
|
|
10
|
my ($object,$mapper ) = @{$self->object}; |
|
6
|
|
|
|
|
34
|
|
10
|
6
|
|
|
|
|
18
|
my $mapper_func = __compose_mapper($mapper); |
11
|
6
|
|
|
|
|
34
|
my $object_iter = $object->iterator; |
12
|
|
|
|
|
|
|
return sub{ |
13
|
3267
|
|
|
3267
|
|
7054
|
my $value = $object_iter->(); |
14
|
3267
|
100
|
|
|
|
11675
|
return $self->LAST if $self->is_last( $value ); |
15
|
3262
|
|
|
|
|
8724
|
return $mapper_func->( $value ); |
16
|
|
|
|
|
|
|
} |
17
|
6
|
|
|
|
|
33
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub __compose_mapper{ |
20
|
6
|
|
|
6
|
|
13
|
my ( $mapper ) = @_; |
21
|
6
|
100
|
|
|
|
34
|
return $mapper if ref $mapper eq 'CODE'; |
22
|
|
|
|
|
|
|
return sub{ |
23
|
15
|
|
|
15
|
|
15
|
my ( $value ) = @_; |
24
|
|
|
|
|
|
|
return +{ |
25
|
15
|
|
|
|
|
101
|
zip @$mapper,@$value |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
1
|
|
|
|
|
4
|
} |
29
|
|
|
|
|
|
|
1; |