| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package TableData::WordList; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
335958
|
use 5.010001; |
|
|
1
|
|
|
|
|
6
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
42
|
|
|
5
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
79
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
689
|
use Role::Tiny::With; |
|
|
1
|
|
|
|
|
9129
|
|
|
|
1
|
|
|
|
|
785
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
|
10
|
|
|
|
|
|
|
our $DATE = '2023-08-27'; # DATE |
|
11
|
|
|
|
|
|
|
our $DIST = 'TableData-WordList'; # DIST |
|
12
|
|
|
|
|
|
|
our $VERSION = '0.001'; # VERSION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with 'TableDataRole::Spec::Basic'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
|
17
|
0
|
|
|
0
|
1
|
|
require Module::Load::Util; |
|
18
|
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my ($class, %args) = @_; |
|
20
|
0
|
0
|
|
|
|
|
defined $args{wordlist} or die "Please specify 'wordlist' argument"; |
|
21
|
|
|
|
|
|
|
bless({ |
|
22
|
|
|
|
|
|
|
wordlist => Module::Load::Util::instantiate_class_with_optional_args( |
|
23
|
0
|
|
|
|
|
|
{ns_prefix=>'WordList'}, $args{wordlist}), |
|
24
|
|
|
|
|
|
|
pos => 0, |
|
25
|
|
|
|
|
|
|
}, $class); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
0
|
|
|
0
|
0
|
|
sub get_column_count { 1 } |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get_column_names { |
|
31
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
32
|
0
|
0
|
|
|
|
|
wantarray ? ('word') : ['word']; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub has_next_item { |
|
36
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
37
|
0
|
0
|
|
|
|
|
return 1 if defined $self->{_next_word}; |
|
38
|
0
|
0
|
|
|
|
|
defined($self->{_next_word} = $self->{wordlist}->next_word) ? 1:0; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub get_next_item { |
|
42
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
43
|
0
|
0
|
|
|
|
|
if (defined $self->{_next_word}) { |
|
44
|
0
|
|
|
|
|
|
$self->{pos}++; |
|
45
|
0
|
|
|
|
|
|
return [delete($self->{_next_word})]; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
0
|
|
|
|
|
|
my $word = $self->{wordlist}->next_word; |
|
48
|
0
|
0
|
|
|
|
|
die "StopIteration" unless defined $word; |
|
49
|
0
|
|
|
|
|
|
$self->{pos}++; |
|
50
|
0
|
|
|
|
|
|
[$word]; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub get_next_row_hashref { |
|
54
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
55
|
0
|
0
|
|
|
|
|
if (defined $self->{_next_word}) { |
|
56
|
0
|
|
|
|
|
|
$self->{pos}++; |
|
57
|
0
|
|
|
|
|
|
return {word => delete($self->{_next_word})}; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
0
|
|
|
|
|
|
my $word = $self->{wordlist}->next_word; |
|
60
|
0
|
0
|
|
|
|
|
die "StopIteration" unless defined $word; |
|
61
|
0
|
|
|
|
|
|
$self->{pos}++; |
|
62
|
0
|
|
|
|
|
|
{word=>$word}; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub get_row_count { |
|
66
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
67
|
0
|
|
|
|
|
|
my $n = 0; |
|
68
|
0
|
|
|
0
|
|
|
$self->{wordlist}->each_word(sub { $n++ }); |
|
|
0
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
$self->{pos} = 0; |
|
70
|
0
|
|
|
|
|
|
$n; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub reset_iterator { |
|
74
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
75
|
0
|
|
|
|
|
|
$self->{wordlist}->reset_iterator; |
|
76
|
0
|
|
|
|
|
|
$self->{pos} = 0; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub get_iterator_pos { |
|
80
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
81
|
0
|
|
|
|
|
|
$self->{pos}; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
|
85
|
|
|
|
|
|
|
# ABSTRACT: List of words from a WordList module |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |