line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WordListRole::EachFromFirstNextReset; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
476
|
use Role::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
requires 'first_word'; |
6
|
|
|
|
|
|
|
requires 'next_word'; |
7
|
|
|
|
|
|
|
requires 'reset_iterator'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
10
|
|
|
|
|
|
|
our $DATE = '2021-09-26'; # DATE |
11
|
|
|
|
|
|
|
our $DIST = 'WordList'; # DIST |
12
|
|
|
|
|
|
|
our $VERSION = '0.7.11'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub each_word { |
15
|
1
|
|
|
1
|
|
217
|
no warnings 'numeric'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
170
|
|
16
|
|
|
|
|
|
|
|
17
|
10
|
|
|
10
|
1
|
1365
|
my ($self, $code) = @_; |
18
|
|
|
|
|
|
|
|
19
|
10
|
|
|
|
|
32
|
$self->reset_iterator; |
20
|
10
|
|
|
|
|
21
|
my $word = $self->first_word; |
21
|
10
|
50
|
|
|
|
28
|
return undef unless defined $word; ## no critic: Subroutines::ProhibitExplicitReturnUndef |
22
|
10
|
|
|
|
|
21
|
my $ret = $code->($word); |
23
|
10
|
100
|
66
|
|
|
44
|
return undef if defined $ret && $ret == -2; ## no critic: Subroutines::ProhibitExplicitReturnUndef |
24
|
7
|
|
|
|
|
12
|
while (1) { |
25
|
14
|
|
|
|
|
29
|
$word = $self->next_word; |
26
|
14
|
100
|
|
|
|
44
|
return undef unless defined $word; ## no critic: Subroutines::ProhibitExplicitReturnUndef |
27
|
7
|
|
|
|
|
15
|
$ret = $code->($word); |
28
|
7
|
50
|
33
|
|
|
33
|
return undef if defined $ret && $ret == -2; ## no critic: Subroutines::ProhibitExplicitReturnUndef |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
# ABSTRACT: Provide each_word(); relies on first_word(), next_word(), reset_iterator() |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |