| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package ArrayData::Test::Source::Iterator; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
516028
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
122
|
|
|
4
|
2
|
|
|
2
|
|
52
|
use 5.010001; |
|
|
2
|
|
|
|
|
8
|
|
|
5
|
2
|
|
|
2
|
|
9
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
38
|
|
|
6
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
114
|
|
|
7
|
2
|
|
|
2
|
|
787
|
use Role::Tiny::With; |
|
|
2
|
|
|
|
|
13638
|
|
|
|
2
|
|
|
|
|
488
|
|
|
8
|
|
|
|
|
|
|
with 'ArrayDataRole::Source::Iterator'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
|
11
|
|
|
|
|
|
|
our $DATE = '2024-05-06'; # DATE |
|
12
|
|
|
|
|
|
|
our $DIST = 'ArrayDataRoles-Standard'; # DIST |
|
13
|
|
|
|
|
|
|
our $VERSION = '0.010'; # VERSION |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
|
16
|
1
|
|
|
1
|
1
|
356191
|
my ($class, %args) = @_; |
|
17
|
1
|
|
50
|
|
|
5
|
$args{num_elems} //= 10; |
|
18
|
1
|
|
50
|
|
|
7
|
$args{random} //= 0; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$class->_new( |
|
21
|
|
|
|
|
|
|
gen_iterator => sub { |
|
22
|
5
|
|
|
5
|
|
8
|
my $i = 0; |
|
23
|
|
|
|
|
|
|
sub { |
|
24
|
17
|
|
|
|
|
25
|
$i++; |
|
25
|
17
|
100
|
|
|
|
135
|
return undef if $i > $args{num_elems}; ## no critic: Subroutines::ProhibitExplicitReturnUndef |
|
26
|
13
|
50
|
|
|
|
33
|
return $args{random} ? int(rand()*$args{num_elems} + 1) : $i; |
|
27
|
5
|
|
|
|
|
39
|
}; |
|
28
|
|
|
|
|
|
|
}, |
|
29
|
1
|
|
|
|
|
13
|
); |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
|
33
|
|
|
|
|
|
|
# ABSTRACT: A test ArrayData module |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |