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