line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Enumerator::Where; |
2
|
4
|
|
|
4
|
|
24
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
348
|
|
3
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
146
|
|
4
|
4
|
|
|
4
|
|
21
|
use List::MoreUtils qw/all natatime/; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
296
|
|
5
|
4
|
|
|
4
|
|
21
|
use base qw/Data::Enumerator::Base/; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
1828
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub iterator { |
8
|
14
|
|
|
14
|
0
|
19
|
my ( $self ) = @_; |
9
|
14
|
|
|
|
|
23
|
my ($object,$filter ) = @{$self->object}; |
|
14
|
|
|
|
|
50
|
|
10
|
14
|
|
|
|
|
63
|
my $object_iterator = $object->iterator; |
11
|
|
|
|
|
|
|
return sub{ |
12
|
432
|
|
|
432
|
|
547
|
while(1){ |
13
|
3682
|
|
|
|
|
8248
|
my $value = $object_iterator->(); |
14
|
3682
|
100
|
|
|
|
62366
|
return $self->LAST if $self->is_last( $value ); |
15
|
3670
|
|
|
|
|
8750
|
my $result = $filter->($value); |
16
|
3670
|
100
|
|
|
|
56783
|
return $self->LAST if $self->is_last( $result ); |
17
|
3668
|
100
|
|
|
|
12382
|
return $value if $result; |
18
|
|
|
|
|
|
|
} |
19
|
14
|
|
|
|
|
85
|
}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub __compose_filter { |
23
|
0
|
|
|
0
|
|
|
my ( $filter ) = @_; |
24
|
0
|
0
|
|
|
|
|
return $filter if ref $filter eq 'CODE'; |
25
|
0
|
|
|
|
|
|
my $iter = natatime(2,@$filter); |
26
|
0
|
|
|
|
|
|
my @funcs; |
27
|
0
|
|
|
|
|
|
while( my ( $column , $expression ) = $iter->() ){ |
28
|
|
|
|
|
|
|
my $sub = sub { |
29
|
0
|
|
|
0
|
|
|
my $value = shift; |
30
|
0
|
|
|
|
|
|
my $target = $value->{$column}; |
31
|
0
|
|
|
|
|
|
return ($target == $expression ); |
32
|
0
|
|
|
|
|
|
}; |
33
|
0
|
|
|
|
|
|
push @funcs,$sub; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
return sub { |
36
|
0
|
|
|
0
|
|
|
my @request = @_; |
37
|
0
|
|
|
|
|
|
all{ $_->(@request)} @funcs |
38
|
0
|
|
|
|
|
|
} |
39
|
0
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|