line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TableData::Test::Source::Iterator; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
71665
|
use 5.010001; |
|
1
|
|
|
|
|
11
|
|
4
|
1
|
|
|
1
|
|
43
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
27
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
431
|
use Role::Tiny::With; |
|
1
|
|
|
|
|
5463
|
|
|
1
|
|
|
|
|
212
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
10
|
|
|
|
|
|
|
our $DATE = '2023-02-24'; # DATE |
11
|
|
|
|
|
|
|
our $DIST = 'TableDataRoles-Standard'; # DIST |
12
|
|
|
|
|
|
|
our $VERSION = '0.015'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with 'TableDataRole::Source::Iterator'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
1
|
|
|
1
|
1
|
129
|
my ($class, %args) = @_; |
18
|
1
|
|
50
|
|
|
20
|
$args{num_rows} //= 10; |
19
|
1
|
|
50
|
|
|
12
|
$args{random} //= 0; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$class->_new( |
22
|
|
|
|
|
|
|
gen_iterator => sub { |
23
|
4
|
|
|
4
|
|
6
|
my $i = 0; |
24
|
|
|
|
|
|
|
sub { |
25
|
9
|
|
|
|
|
13
|
$i++; |
26
|
9
|
100
|
|
|
|
20
|
return undef if $i > $args{num_rows}; ## no critic: Subroutines::ProhibitExplicitReturnUndef |
27
|
8
|
50
|
|
|
|
29
|
return {i=>$args{random} ? int(rand()*$args{num_rows} + 1) : $i}; |
28
|
4
|
|
|
|
|
30
|
}; |
29
|
|
|
|
|
|
|
}, |
30
|
1
|
|
|
|
|
11
|
); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
# ABSTRACT: A test table |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |