line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Enumerator::Range; |
2
|
8
|
|
|
8
|
|
46
|
use strict; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
390
|
|
3
|
8
|
|
|
8
|
|
42
|
use warnings; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
280
|
|
4
|
8
|
|
|
8
|
|
37
|
use base qw/Data::Enumerator::Base/; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
2812
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
2
|
|
|
2
|
0
|
6
|
my ( $class, $start, $end, $succ ) = @_; |
8
|
2
|
|
|
|
|
17
|
return bless { |
9
|
|
|
|
|
|
|
start => $start, |
10
|
|
|
|
|
|
|
end => $end, |
11
|
|
|
|
|
|
|
succ => $succ, |
12
|
|
|
|
|
|
|
}, $class; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub iterator { |
16
|
2
|
|
|
2
|
0
|
5
|
my ( $self ) = @_; |
17
|
2
|
|
|
|
|
17
|
my $counter = $self->{start}; |
18
|
2
|
|
|
|
|
5
|
my $end = $self->{end}; |
19
|
2
|
|
|
|
|
5
|
my $succ = $self->{succ}; |
20
|
2
|
50
|
|
22
|
|
13
|
my $succ_func = (ref $succ) ? $succ : sub{ $_[0]+$succ}; |
|
22
|
|
|
|
|
49
|
|
21
|
|
|
|
|
|
|
return sub{ |
22
|
24
|
100
|
|
24
|
|
83
|
return $self->LAST if $counter >= $end; |
23
|
22
|
|
|
|
|
27
|
my $prev = $counter; |
24
|
22
|
|
|
|
|
46
|
$counter = $succ_func->($counter); |
25
|
22
|
|
|
|
|
54
|
return $prev; |
26
|
2
|
|
|
|
|
17
|
}; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
1; |