line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ODS::Table::Generate::Data; |
2
|
59
|
|
|
59
|
|
24839
|
use strict; |
|
59
|
|
|
|
|
59
|
|
|
59
|
|
|
|
|
1475
|
|
3
|
59
|
|
|
59
|
|
295
|
use warnings; |
|
59
|
|
|
|
|
59
|
|
|
59
|
|
|
|
|
1180
|
|
4
|
59
|
|
|
59
|
|
236
|
use YAOO; |
|
59
|
|
|
|
|
59
|
|
|
59
|
|
|
|
|
236
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
auto_build; |
7
|
|
|
|
|
|
|
|
8
|
59
|
|
|
59
|
|
23246
|
use ODS::Utils qw/load/; |
|
59
|
|
|
|
|
118
|
|
|
59
|
|
|
|
|
236
|
|
9
|
|
|
|
|
|
|
|
10
|
59
|
|
|
59
|
|
33807
|
use Term::ProgressSpinner; |
|
59
|
|
|
|
|
1419363
|
|
|
59
|
|
|
|
|
47613
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has table_class => isa(string); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has table_class_type => isa(string); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has table_class_connect => isa(hash); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has total => isa(integer); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Acme::MetaSyntactic class or one that follows the same standard |
21
|
|
|
|
|
|
|
has data_class => isa(string('Acme::MetaSyntactic')), build_order(1); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has data_class_theme => isa(string), build_order(2); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has data_class_total => isa(integer(10)); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has auto_increment => isa(integer), default(0); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has default_strings => isa(array), delay, coerce(sub { |
30
|
|
|
|
|
|
|
my ($self, $data) = @_; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
if ($self->data_class_theme) { |
33
|
|
|
|
|
|
|
load $self->data_class; |
34
|
|
|
|
|
|
|
my $meta = $self->data_class->new($self->data_class_theme); |
35
|
|
|
|
|
|
|
my @syntactic = $meta->name( $self->data_class_total ); |
36
|
|
|
|
|
|
|
return \@syntactic; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
return [ |
39
|
|
|
|
|
|
|
"Barbarians", |
40
|
|
|
|
|
|
|
"Gunga Din", |
41
|
|
|
|
|
|
|
"Fame and Fortune", |
42
|
|
|
|
|
|
|
"Anthem For Doomed Youth", |
43
|
|
|
|
|
|
|
"You're My Waterloo", |
44
|
|
|
|
|
|
|
"Belly of the Beast", |
45
|
|
|
|
|
|
|
"Iceman", |
46
|
|
|
|
|
|
|
"Heart of the Matter", |
47
|
|
|
|
|
|
|
"The Milkman's Horse", |
48
|
|
|
|
|
|
|
"Ruling Force", |
49
|
|
|
|
|
|
|
"Worlds on Fire", |
50
|
|
|
|
|
|
|
"Ninja", |
51
|
|
|
|
|
|
|
"Open Eyes", |
52
|
|
|
|
|
|
|
"Dollars and Dimes", |
53
|
|
|
|
|
|
|
"Saturday", |
54
|
|
|
|
|
|
|
"More Fire", |
55
|
|
|
|
|
|
|
"Ghetto Long Time", |
56
|
|
|
|
|
|
|
"Liberate", |
57
|
|
|
|
|
|
|
"Today", |
58
|
|
|
|
|
|
|
"Ave Adore", |
59
|
|
|
|
|
|
|
"House I Built", |
60
|
|
|
|
|
|
|
"Catch a Vibe", |
61
|
|
|
|
|
|
|
"Chasing Cars", |
62
|
|
|
|
|
|
|
"Gleaming Auction", |
63
|
|
|
|
|
|
|
"Made of Stone", |
64
|
|
|
|
|
|
|
"Bounce", |
65
|
|
|
|
|
|
|
"Forest", |
66
|
|
|
|
|
|
|
"Sweet Disposition", |
67
|
|
|
|
|
|
|
"Science Of Fear", |
68
|
|
|
|
|
|
|
"The Motto", |
69
|
|
|
|
|
|
|
"Mysterious Ways" |
70
|
|
|
|
|
|
|
]; |
71
|
|
|
|
|
|
|
}); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
has default_integers => isa(array([ 1 .. 100 ])); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
has default_floats => isa(array([ (map { sprintf "%.2f", "1.$_" } 0 .. 99) ])); |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
has default_emails_domains => isa(array([ |
78
|
|
|
|
|
|
|
"lnation.org", |
79
|
|
|
|
|
|
|
"world-wide.world", |
80
|
|
|
|
|
|
|
"notifi.site", |
81
|
|
|
|
|
|
|
"supervisor.fun", |
82
|
|
|
|
|
|
|
"supervisor.guru", |
83
|
|
|
|
|
|
|
"autonomous.cyou", |
84
|
|
|
|
|
|
|
"notifi.page" |
85
|
|
|
|
|
|
|
])); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
has default_epoch => isa(array([ map { 1645016769 - (300 * $_) } 1 .. 50 ])); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
has default_phone => isa(array), delay, coerce(sub { |
90
|
|
|
|
|
|
|
my ($self) = @_; |
91
|
|
|
|
|
|
|
my @numbers = (); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my $total = $self->data_class_total; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
for (1 .. $self->data_class_total) { |
96
|
|
|
|
|
|
|
push @numbers, '+' . map { int(rand(10)) } 0 .. 12 |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
return \@numbers; |
99
|
|
|
|
|
|
|
}); |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub generate { |
102
|
59
|
|
|
59
|
0
|
1475
|
my ($self) = @_; |
103
|
|
|
|
|
|
|
|
104
|
59
|
|
|
|
|
590
|
load $self->table_class; |
105
|
|
|
|
|
|
|
|
106
|
59
|
|
|
|
|
590
|
my $table = $self->table_class->connect($self->table_class_type, $self->table_class_connect); |
107
|
|
|
|
|
|
|
|
108
|
59
|
|
|
|
|
10089
|
$table->table->rows([]); |
109
|
|
|
|
|
|
|
|
110
|
59
|
|
|
|
|
2891
|
my $ps = Term::ProgressSpinner->new( |
111
|
|
|
|
|
|
|
text_color => 'black on_bright_black', |
112
|
|
|
|
|
|
|
precision => 2, |
113
|
|
|
|
|
|
|
); |
114
|
|
|
|
|
|
|
|
115
|
59
|
|
|
|
|
9735
|
$ps->start($self->total); |
116
|
|
|
|
|
|
|
|
117
|
59
|
|
|
|
|
629412
|
my $i = 1; |
118
|
59
|
|
|
|
|
1062
|
while ($ps->advance) { |
119
|
1711
|
|
|
|
|
3005047
|
my %row = (); |
120
|
1711
|
|
|
|
|
4602
|
for my $column ( keys %{ $table->table->columns } ) { |
|
1711
|
|
|
|
|
14337
|
|
121
|
25665
|
|
|
|
|
331049
|
$column = $table->table->columns->{$column}; |
122
|
25665
|
|
|
|
|
373293
|
my $callback = 'generate_' . $column->{type}; |
123
|
25665
|
|
|
|
|
59000
|
$row{$column->name} = $self->$callback($column); |
124
|
|
|
|
|
|
|
} |
125
|
1711
|
|
|
|
|
27081
|
$table->create(\%row); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub generate_integer { |
130
|
1711
|
|
|
1711
|
0
|
4956
|
my ($self, $row) = @_; |
131
|
|
|
|
|
|
|
|
132
|
1711
|
50
|
|
|
|
9086
|
if ($row->auto_increment) { |
133
|
1711
|
|
|
|
|
17287
|
$self->auto_increment($self->auto_increment + 1); |
134
|
1711
|
|
|
|
|
78234
|
return $self->auto_increment; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
0
|
my $integers = $self->default_integers; |
138
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
0
|
return $integers->[int(rand(scalar @{$integers}))] |
|
0
|
|
|
|
|
0
|
|
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub generate_string { |
143
|
17110
|
|
|
17110
|
0
|
23718
|
my ($self, $row) = @_; |
144
|
|
|
|
|
|
|
|
145
|
17110
|
|
|
|
|
29205
|
my $strings = $self->default_strings; |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
148
|
17110
|
|
|
|
|
76582
|
return $strings->[int(rand(scalar @{$strings}))]; |
|
17110
|
|
|
|
|
55932
|
|
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub generate_boolean { |
152
|
3422
|
|
|
3422
|
0
|
6254
|
my ($self, $row) = @_; |
153
|
|
|
|
|
|
|
|
154
|
3422
|
|
|
|
|
6195
|
my $boolean = int(rand(2)); |
155
|
|
|
|
|
|
|
|
156
|
3422
|
|
|
|
|
12567
|
return \$boolean; |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub generate_phone { |
160
|
0
|
|
|
0
|
0
|
0
|
my ($self, $row) = @_; |
161
|
|
|
|
|
|
|
|
162
|
0
|
|
|
|
|
0
|
my $phone = $self->default_phone; |
163
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
0
|
return $phone->[int(rand(scalar @{$phone}))]; |
|
0
|
|
|
|
|
0
|
|
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub generate_epoch { |
168
|
3422
|
|
|
3422
|
0
|
7375
|
my ($self, $row) = @_; |
169
|
|
|
|
|
|
|
|
170
|
3422
|
|
|
|
|
10679
|
my $epoch = $self->default_epoch; |
171
|
|
|
|
|
|
|
|
172
|
3422
|
|
|
|
|
18349
|
return $epoch->[int(rand(scalar @{$epoch}))]; |
|
3422
|
|
|
|
|
16048
|
|
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
1; |