line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WordList::Test::Dynamic::OneTwo_FirstNextReset; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
4
|
|
|
|
|
|
|
our $DATE = '2021-06-23'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'WordList'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.7.10'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
2075
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
4
|
use WordList; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(WordList); |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
4
|
use Role::Tiny::With; |
|
1
|
|
|
|
|
16
|
|
|
1
|
|
|
|
|
252
|
|
14
|
|
|
|
|
|
|
with 'WordListRole::EachFromFirstNextReset'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $DYNAMIC = 1; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub reset_iterator { |
19
|
22
|
|
|
22
|
1
|
27
|
my $self = shift; |
20
|
22
|
|
|
|
|
34
|
$self->{_iterator_idx} = 0; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub first_word { |
24
|
11
|
|
|
11
|
1
|
2191
|
my $self = shift; |
25
|
11
|
|
|
|
|
18
|
$self->reset_iterator; |
26
|
11
|
|
|
|
|
30
|
$self->next_word; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub next_word { |
30
|
29
|
|
|
29
|
1
|
37
|
my $self = shift; |
31
|
29
|
50
|
|
|
|
52
|
$self->{_iterator_idx} = 0 unless defined $self->{_iterator_idx}; |
32
|
|
|
|
|
|
|
|
33
|
29
|
|
|
|
|
38
|
$self->{_iterator_idx}++; |
34
|
29
|
100
|
|
|
|
51
|
if ($self->{_iterator_idx} == 1) { return "one" } |
|
12
|
100
|
|
|
|
28
|
|
35
|
9
|
|
|
|
|
20
|
elsif ($self->{_iterator_idx} == 2) { return "two" } |
36
|
8
|
|
|
|
|
14
|
else { return undef } |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
our %STATS = ("avg_word_len",3,"num_words_contain_unicode",0,"num_words_contains_whitespace",0,"num_words_contain_whitespace",0,"num_words_contains_nonword_chars",0,"num_words",2,"shortest_word_len",3,"num_words_contains_unicode",0,"num_words_contain_nonword_chars",0,"longest_word_len",3); # STATS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
# ABSTRACT: Wordlist that returns one, two (via implementing first_word(), next_word(), and reset_iterator()) |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |