line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!perl |
2
|
1
|
|
|
1
|
|
108632
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
3
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
47
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# SEE THE END OF THIS FILE FOR AUTHOR, COPYRIGHT AND LICENSE INFORMATION |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
{ package Algorithm::Odometer::Tiny; |
8
|
|
|
|
|
|
|
our $VERSION = "0.04"; |
9
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
36
|
|
|
1
|
|
|
|
|
145
|
|
10
|
|
|
|
|
|
|
use overload '<>' => sub { |
11
|
1123
|
|
|
1123
|
|
4896
|
my $self = shift; |
12
|
1123
|
100
|
|
|
|
2658
|
return $self->() unless wantarray; |
13
|
1
|
|
|
|
|
3
|
my @all; |
14
|
1
|
|
|
|
|
4
|
while (defined( my $x = $self->() )) |
15
|
6
|
|
|
|
|
19
|
{ push @all, $x } |
16
|
1
|
|
|
|
|
11
|
return @all; |
17
|
1
|
|
|
1
|
|
1301
|
}; |
|
1
|
|
|
|
|
1114
|
|
|
1
|
|
|
|
|
11
|
|
18
|
|
|
|
|
|
|
sub new { ## no critic (RequireArgUnpacking) |
19
|
9
|
|
|
9
|
0
|
28448
|
my $class = shift; |
20
|
9
|
|
|
|
|
25
|
return bless odometer(@_), $class; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
sub odometer { ## no critic (RequireArgUnpacking) |
23
|
9
|
100
|
|
9
|
0
|
234
|
croak "no wheels specified" unless @_; |
24
|
8
|
100
|
|
|
|
18
|
my @w = map { [ 1, ref eq 'ARRAY' ? @$_ : $_ ] } @_; |
|
22
|
|
|
|
|
96
|
|
25
|
8
|
|
|
|
|
15
|
my $done; |
26
|
|
|
|
|
|
|
return sub { |
27
|
1152
|
100
|
|
1152
|
|
2952
|
if ($done) { $done=0; return } |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
24
|
|
28
|
1144
|
|
|
|
|
1766
|
my @cur = map {$$_[$$_[0]]} @w; |
|
3518
|
|
|
|
|
5971
|
|
29
|
1144
|
|
|
|
|
2431
|
for(my $i=$#w;$i>=0;$i--) { |
30
|
1281
|
100
|
|
|
|
1838
|
last if ++$w[$i][0]<@{$w[$i]}; |
|
1281
|
|
|
|
|
2429
|
|
31
|
145
|
|
|
|
|
212
|
$w[$i][0]=1; |
32
|
145
|
100
|
|
|
|
320
|
$done=1 unless $i; |
33
|
|
|
|
|
|
|
} |
34
|
1144
|
100
|
|
|
|
2172
|
return wantarray ? @cur : join '', map {defined()?$_:''} @cur; |
|
3484
|
100
|
|
|
|
8808
|
|
35
|
8
|
|
|
|
|
48
|
}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Possible To-Do for Later: Generate regexes based on the wheels? |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
__END__ |