| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package ODS::Table::Generate; |
|
2
|
1
|
|
|
1
|
|
61959
|
use strict; |
|
|
1
|
|
|
|
|
10
|
|
|
|
1
|
|
|
|
|
35
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
23
|
|
|
4
|
1
|
|
|
1
|
|
421
|
use YAOO; |
|
|
1
|
|
|
|
|
25343
|
|
|
|
1
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
651
|
use ODS::Utils qw/load valid_email valid_phone file_dir/; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
auto_build; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has serializer => isa(object), required, coerce(sub { |
|
11
|
|
|
|
|
|
|
my ($self, $value) = @_; |
|
12
|
|
|
|
|
|
|
my $module = 'ODS::Serialize::' . $value; |
|
13
|
|
|
|
|
|
|
load $module; |
|
14
|
|
|
|
|
|
|
$module->new; |
|
15
|
|
|
|
|
|
|
}); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has table_class => isa(string); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has table_base_class => isa(string); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has in_directory => isa(string); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has out_directory => isa(string), required; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has file => isa(string); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has table_from_file_name => isa(boolean); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has build_objects => isa(boolean); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has keyfield => isa(string); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has column_defaults => isa(ordered_hash( |
|
34
|
|
|
|
|
|
|
type => undef, |
|
35
|
|
|
|
|
|
|
mandatory => \0, |
|
36
|
|
|
|
|
|
|
no_render => \0, |
|
37
|
|
|
|
|
|
|
sortable => \0, |
|
38
|
|
|
|
|
|
|
filterable => \0, |
|
39
|
|
|
|
|
|
|
field => undef, |
|
40
|
|
|
|
|
|
|
)); |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has array_defaults => isa(ordered_hash( |
|
43
|
|
|
|
|
|
|
min_length => \0, |
|
44
|
|
|
|
|
|
|
max_length => undef |
|
45
|
|
|
|
|
|
|
)); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
has boolean_defaults => isa(ordered_hash()); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
has email_defaults => isa(ordered_hash()); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has epoch_defaults => isa(ordered_hash()); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
has float_defaults => isa(ordered_hash( |
|
54
|
|
|
|
|
|
|
precision => undef, |
|
55
|
|
|
|
|
|
|
number => \1 |
|
56
|
|
|
|
|
|
|
)); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
has hash_defaults => isa(ordered_hash( |
|
59
|
|
|
|
|
|
|
required_keys => undef |
|
60
|
|
|
|
|
|
|
)); |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
has integer_defaults => isa(ordered_hash( |
|
63
|
|
|
|
|
|
|
auto_increment => \0 |
|
64
|
|
|
|
|
|
|
)); |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
has object_defaults => isa(ordered_hash( |
|
67
|
|
|
|
|
|
|
object_class => undef |
|
68
|
|
|
|
|
|
|
)); |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
has phone_defaults => isa(ordered_hash); |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
has string_defaults => isa(ordered_hash); |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
has build_resultset_class => isa(boolean(1)); |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
has build_row_class => isa(boolean(1)); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub generate { |
|
79
|
1
|
|
|
1
|
0
|
138
|
my ($self) = @_; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# TODO read in existing table spec, parse the file and merge so that it doesn't just overwrite custom column |
|
82
|
|
|
|
|
|
|
# definitions. |
|
83
|
|
|
|
|
|
|
|
|
84
|
1
|
|
|
|
|
2
|
my $files = $self->read_files(); |
|
85
|
|
|
|
|
|
|
|
|
86
|
1
|
|
|
|
|
2
|
for my $file ( keys %{ $files } ) { |
|
|
1
|
|
|
|
|
3
|
|
|
87
|
1
|
|
|
|
|
3
|
my $table_class = $self->generate_table($file, $files->{$file}); |
|
88
|
1
|
50
|
|
|
|
4
|
$self->generate_resultset($table_class) if $self->build_resultset_class; |
|
89
|
1
|
50
|
|
|
|
26
|
$self->generate_row($table_class) if $self->build_row_class; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub generate_resultset { |
|
94
|
1
|
|
|
1
|
0
|
15
|
my ($self, $class) = @_; |
|
95
|
|
|
|
|
|
|
|
|
96
|
1
|
|
|
|
|
4
|
$class =~ s/Table/ResultSet/; |
|
97
|
|
|
|
|
|
|
|
|
98
|
1
|
|
|
|
|
7
|
my $resultset = qq|package ${class}; |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
use YAOO; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
extends 'ODS::Table::ResultSet'; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# insert custom sub routines/methods for the resultset here |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
__END__|; |