line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ArrayData::Test::Spec::Basic; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
4
|
|
|
|
|
|
|
our $DATE = '2021-05-18'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'ArrayData'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.2.3'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
75154
|
use strict; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
31
|
|
9
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
478
|
use Role::Tiny::With; |
|
1
|
|
|
|
|
5186
|
|
|
1
|
|
|
|
|
294
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'ArrayDataRole::Spec::Basic'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $elems = [ |
16
|
|
|
|
|
|
|
1, |
17
|
|
|
|
|
|
|
2, |
18
|
|
|
|
|
|
|
undef, |
19
|
|
|
|
|
|
|
4, |
20
|
|
|
|
|
|
|
]; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new { |
23
|
1
|
|
|
1
|
0
|
89
|
my $class = shift; |
24
|
1
|
|
|
|
|
5
|
bless {pos=>0}, $class; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _elems { |
28
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
29
|
0
|
|
|
|
|
0
|
$elems; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub get_next_item { |
33
|
19
|
|
|
19
|
0
|
89
|
my $self = shift; |
34
|
19
|
100
|
|
|
|
70
|
die "StopIteration" unless $self->{pos} < @$elems; |
35
|
18
|
|
|
|
|
53
|
$elems->[ $self->{pos}++ ]; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub has_next_item { |
39
|
17
|
|
|
17
|
0
|
1369
|
my $self = shift; |
40
|
17
|
|
|
|
|
118
|
$self->{pos} < @$elems; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub get_iterator_pos { |
44
|
1
|
|
|
1
|
0
|
5
|
my $self = shift; |
45
|
1
|
|
|
|
|
4
|
$self->{pos}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub reset_iterator { |
49
|
5
|
|
|
5
|
0
|
7453
|
my $self = shift; |
50
|
5
|
|
|
|
|
12
|
$self->{pos} = 0; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub get_item_at_pos { |
54
|
2
|
|
|
2
|
0
|
2564
|
my ($self, $pos) = @_; |
55
|
2
|
50
|
|
|
|
7
|
if ($pos < 0) { |
56
|
0
|
0
|
|
|
|
0
|
die "Out of range" unless -$pos <= @$elems; |
57
|
|
|
|
|
|
|
} else { |
58
|
2
|
100
|
|
|
|
18
|
die "Out of range" unless $pos < @$elems; |
59
|
|
|
|
|
|
|
} |
60
|
1
|
|
|
|
|
4
|
$elems->[ $pos ]; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub has_item_at_pos { |
64
|
2
|
|
|
2
|
0
|
6
|
my ($self, $pos) = @_; |
65
|
2
|
50
|
|
|
|
7
|
if ($pos < 0) { |
66
|
0
|
0
|
|
|
|
0
|
return -$pos <= @$elems ? 1:0; |
67
|
|
|
|
|
|
|
} else { |
68
|
2
|
100
|
|
|
|
12
|
return $pos < @$elems ? 1:0; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# ABSTRACT: A test table data |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |