line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tables::Test::Dynamic; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
4
|
|
|
|
|
|
|
our $DATE = '2020-11-10'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'TablesRoles-Standard'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.006'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
71881
|
use 5.010001; |
|
1
|
|
|
|
|
12
|
|
9
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
10
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
11
|
1
|
|
|
1
|
|
426
|
use Role::Tiny::With; |
|
1
|
|
|
|
|
5401
|
|
|
1
|
|
|
|
|
168
|
|
12
|
|
|
|
|
|
|
with 'TablesRole::Source::Iterator'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
1
|
|
|
1
|
1
|
99
|
my ($class, %args) = @_; |
16
|
1
|
|
50
|
|
|
5
|
$args{num_rows} //= 10; |
17
|
1
|
|
50
|
|
|
33
|
$args{random} //= 0; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$class->_new( |
20
|
|
|
|
|
|
|
gen_iterator => sub { |
21
|
4
|
|
|
4
|
|
8
|
my $i = 0; |
22
|
|
|
|
|
|
|
sub { |
23
|
12
|
|
|
|
|
18
|
$i++; |
24
|
12
|
100
|
|
|
|
30
|
return undef if $i > $args{num_rows}; |
25
|
10
|
50
|
|
|
|
46
|
return {i=>$args{random} ? int(rand()*$args{num_rows} + 1) : $i}; |
26
|
4
|
|
|
|
|
30
|
}; |
27
|
|
|
|
|
|
|
}, |
28
|
1
|
|
|
|
|
9
|
); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
# ABSTRACT: A dynamic table |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |