| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WordListRole::EachFromFirstNextReset; | 
| 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 |  | 481 | use Role::Tiny; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | requires 'first_word'; | 
| 11 |  |  |  |  |  |  | requires 'next_word'; | 
| 12 |  |  |  |  |  |  | requires 'reset_iterator'; | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | sub each_word { | 
| 15 | 1 |  |  | 1 |  | 158 | no warnings 'numeric'; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 129 |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 10 |  |  | 10 | 1 | 1239 | my ($self, $code) = @_; | 
| 18 |  |  |  |  |  |  |  | 
| 19 | 10 |  |  |  |  | 26 | $self->reset_iterator; | 
| 20 | 10 |  |  |  |  | 17 | my $word = $self->first_word; | 
| 21 | 10 | 50 |  |  |  | 19 | return undef unless defined $word; | 
| 22 | 10 |  |  |  |  | 21 | my $ret = $code->($word); | 
| 23 | 10 | 100 | 100 |  |  | 39 | return undef if defined $ret && $ret == -2; | 
| 24 | 7 |  |  |  |  | 8 | while (1) { | 
| 25 | 14 |  |  |  |  | 23 | $word = $self->next_word; | 
| 26 | 14 | 100 |  |  |  | 30 | return undef unless defined $word; | 
| 27 | 7 |  |  |  |  | 9 | $ret = $code->($word); | 
| 28 | 7 | 50 | 66 |  |  | 23 | return undef if defined $ret && $ret == -2; | 
| 29 |  |  |  |  |  |  | } | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | 1; | 
| 33 |  |  |  |  |  |  | # ABSTRACT: Provide each_word(); relies on first_word(), next_word(), reset_iterator() | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | __END__ |