line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Role::TinyCommons::Iterator::Basic; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
173638
|
use strict; |
|
2
|
|
|
|
|
31
|
|
|
2
|
|
|
|
|
61
|
|
4
|
2
|
|
|
2
|
|
11
|
use Role::Tiny; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
7
|
|
|
|
|
|
|
our $DATE = '2021-10-07'; # DATE |
8
|
|
|
|
|
|
|
our $DIST = 'RoleBundle-TinyCommons-Iterator'; # DIST |
9
|
|
|
|
|
|
|
our $VERSION = '0.004'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
### required |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
requires 'get_next_item'; |
14
|
|
|
|
|
|
|
requires 'has_next_item'; |
15
|
|
|
|
|
|
|
requires 'get_iterator_pos'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
### provided |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub get_coderef_iterator { |
20
|
0
|
|
|
0
|
1
|
|
my ($self, $dies) = @_; |
21
|
0
|
0
|
|
|
|
|
if ($dies) { |
22
|
0
|
|
|
0
|
|
|
return sub { $self->get_next_item }; |
|
0
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
} else { |
24
|
0
|
0
|
|
0
|
|
|
return sub { $self->has_next_item ? $self->get_next_item : undef }; |
|
0
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
# ABSTRACT: A basic iterator |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |