| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Bigtop::ScriptHelp::Style; |
|
2
|
2
|
|
|
2
|
|
26429
|
use strict; use warnings; |
|
|
2
|
|
|
2
|
|
4
|
|
|
|
2
|
|
|
|
|
65
|
|
|
|
2
|
|
|
|
|
10
|
|
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
59
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
18
|
use File::Spec; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
356
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub get_style { |
|
7
|
1
|
|
|
1
|
1
|
11
|
my $class = shift; |
|
8
|
1
|
|
50
|
|
|
5
|
my $style = shift || 'Kickstart'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
|
|
31
|
my $style_module_file = File::Spec->catfile( |
|
11
|
|
|
|
|
|
|
'Bigtop', 'ScriptHelp', 'Style', "$style.pm" |
|
12
|
|
|
|
|
|
|
); |
|
13
|
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
814
|
require $style_module_file; |
|
15
|
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
6
|
my $style_package = 'Bigtop::ScriptHelp::Style::' . $style; |
|
17
|
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
18
|
return $style_package->new(); |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
|
22
|
1
|
|
|
1
|
1
|
4
|
my $class = shift; |
|
23
|
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
10
|
return bless {}, $class; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Bigtop::ScriptHelp::Style - Factory for scripts' command line and standard in handlers |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
use Bigtop::ScriptHelp; |
|
36
|
|
|
|
|
|
|
use Bigtop::ScriptHelp::Style; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $style = ... |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $style_helper = Bigtop::ScriptHelp::Style->get_style( $style ); |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# pass this style as the first parameter to |
|
43
|
|
|
|
|
|
|
# Bigtop::ScriptHelp->get_big_default |
|
44
|
|
|
|
|
|
|
# Bigtop::ScriptHelp->augment_tree |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This module factors command line argument and standard in handling out of |
|
49
|
|
|
|
|
|
|
scripts and ScriptHelp. It is a simple factory. Call C |
|
50
|
|
|
|
|
|
|
with the name of a style module, to receive a style suitable for passing |
|
51
|
|
|
|
|
|
|
to C<get_big_default>> and |
|
52
|
|
|
|
|
|
|
C<augment_tree>>. All styles live in the |
|
53
|
|
|
|
|
|
|
Bigtop::ScriptHelp::Style:: namespace. The default style is 'Kickstart'. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Each stye must implement C which is the only method called by |
|
56
|
|
|
|
|
|
|
C methods. See below for what it receives and returns. |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 METHODS |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=over 4 |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item get_style |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Factory method. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Parameter: style name. This must be the name of a module in the |
|
67
|
|
|
|
|
|
|
Bigtop::ScriptHelp::Style:: namespace. |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Returns: and object of the named style which responds to C. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item new |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Trivial constructor used internally to make an object solely to provide |
|
74
|
|
|
|
|
|
|
dispatching to C. All Styles should subclass from this |
|
75
|
|
|
|
|
|
|
class, but they are welcome to override or augment C. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=back |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 SUBCLASS METHODS |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
All subclasses should live in the Bigtop::ScriptHelp::Style:: namespace |
|
82
|
|
|
|
|
|
|
and implement one method: |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=over 4 |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item get_db_layout |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Parameters: |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=over 4 |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item invocant |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
usually useless |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item art |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
all command line args joined by spaces. Note that flags should have already |
|
99
|
|
|
|
|
|
|
been consumed by some script. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item tables |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
a hash reference keyed by existing table name, the values are always 1 |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=back |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Returns: a single hash reference with these keys: |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=over 4 |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item all_tables |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
the tables hash from the passed in parameters with an extra key for each |
|
114
|
|
|
|
|
|
|
new table |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item new_tables |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
an array reference of new tables names |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item joiners |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
( Optional ) |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
an array reference of new three way join tables |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item foreigners |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
( Optional ) |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
a hash reference keyed by table name storing an array reference of |
|
131
|
|
|
|
|
|
|
the table's new foreign keys |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=back |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=back |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 AUTHOR |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Phil Crow, Ecrow.phil@gmail.comE |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Copyright (C) 2007, Phil Crow |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
146
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.6 or, |
|
147
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |