| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Bigtop::Backend::Control; |
|
2
|
1
|
|
|
1
|
|
5
|
use strict; use warnings; |
|
|
1
|
|
|
1
|
|
53
|
|
|
|
1
|
|
|
|
|
189
|
|
|
|
1
|
|
|
|
|
85
|
|
|
|
1
|
|
|
|
|
23
|
|
|
|
1
|
|
|
|
|
492
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use Bigtop::Keywords; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
119
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
#----------------------------------------------------------------- |
|
7
|
|
|
|
|
|
|
# Register keywords in the grammar |
|
8
|
|
|
|
|
|
|
#----------------------------------------------------------------- |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %controller_keywords; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
BEGIN { |
|
13
|
1
|
|
|
1
|
|
3
|
my @controller_keywords = qw( |
|
14
|
|
|
|
|
|
|
controls_table |
|
15
|
|
|
|
|
|
|
gen_uses |
|
16
|
|
|
|
|
|
|
stub_uses |
|
17
|
|
|
|
|
|
|
uses |
|
18
|
|
|
|
|
|
|
text_description |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
9
|
@controller_keywords{ @controller_keywords } = @controller_keywords; |
|
22
|
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
8
|
Bigtop::Parser->add_valid_keywords( |
|
24
|
|
|
|
|
|
|
Bigtop::Keywords->get_docs_for( |
|
25
|
|
|
|
|
|
|
'controller', |
|
26
|
|
|
|
|
|
|
qw( |
|
27
|
|
|
|
|
|
|
controls_table |
|
28
|
|
|
|
|
|
|
gen_uses |
|
29
|
|
|
|
|
|
|
stub_uses |
|
30
|
|
|
|
|
|
|
uses |
|
31
|
|
|
|
|
|
|
text_description |
|
32
|
|
|
|
|
|
|
location |
|
33
|
|
|
|
|
|
|
rel_location |
|
34
|
|
|
|
|
|
|
skip_test |
|
35
|
|
|
|
|
|
|
soap_name |
|
36
|
|
|
|
|
|
|
namespace_base |
|
37
|
|
|
|
|
|
|
) |
|
38
|
|
|
|
|
|
|
) |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
4
|
Bigtop::Parser->add_valid_keywords( |
|
42
|
|
|
|
|
|
|
Bigtop::Keywords->get_docs_for( |
|
43
|
|
|
|
|
|
|
'app', |
|
44
|
|
|
|
|
|
|
qw( |
|
45
|
|
|
|
|
|
|
authors |
|
46
|
|
|
|
|
|
|
contact_us |
|
47
|
|
|
|
|
|
|
email |
|
48
|
|
|
|
|
|
|
copyright_holder |
|
49
|
|
|
|
|
|
|
license_text |
|
50
|
|
|
|
|
|
|
uses |
|
51
|
|
|
|
|
|
|
location |
|
52
|
|
|
|
|
|
|
) |
|
53
|
|
|
|
|
|
|
) |
|
54
|
|
|
|
|
|
|
); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub is_controller_keyword { |
|
59
|
0
|
|
|
0
|
1
|
|
shift; |
|
60
|
0
|
|
|
|
|
|
my $candidate = shift; |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
return $controller_keywords{ $candidate }; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 NAME |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Bigtop::Backend::Control - defines legal keywords in control blocks |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
If you are making a control generating backend: |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
use Bigtop::Backend::Control; |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This specifies the valid keywords for the controller. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
If you need additional keywords which are generally useful, add them |
|
80
|
|
|
|
|
|
|
here (and send in a patch). If you need backend specific keywords, register |
|
81
|
|
|
|
|
|
|
them within your backend module. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
If you are using a Bigtop backend which generates controllers, you should read |
|
86
|
|
|
|
|
|
|
this document to find out what the valid keywords inside controller blocks |
|
87
|
|
|
|
|
|
|
are and what affect they have. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
If you are writing a Bigtop backend which generates controllers, you should |
|
90
|
|
|
|
|
|
|
use this module. That will register the standard controller keywords with |
|
91
|
|
|
|
|
|
|
the Bigtop parser. |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 BASIC STRUCTURE |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
A controller block looks like this: |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
controller name { } |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Inside the braces, you can include simple statements or method blocks. |
|
100
|
|
|
|
|
|
|
Each method block looks like this: |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
method name is type { } |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
The type must be supported by your backend. Look in its pod for |
|
105
|
|
|
|
|
|
|
SUPPORTED TYPES. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 KEYWORDS in app blocks |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This module registers these keywords in app blocks: |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=over 4 |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item authors |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
These are the authors which Control backends will put in the pod |
|
116
|
|
|
|
|
|
|
stub for each generated module. Unless you use the copyright_holder |
|
117
|
|
|
|
|
|
|
statement, the first author will also be used as the copyright holder. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Entries in this list may be either simple names or name => email pairs. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item contact_us |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Text to include in the CONTACT US section of the base module's POD. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item copyright_holder |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This string will come at the end of the phrase Copyright... |
|
128
|
|
|
|
|
|
|
in the pod. By default, it will be the first person in the authors list. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item email |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Deprecated synonymn for contact_us. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
This will be presented by the Control backend as the author's email |
|
135
|
|
|
|
|
|
|
in the AUTHOR section of the pod block at the bottom of each module. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item license_text |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
The exact text of the paragraph that comes directly after the copyright |
|
140
|
|
|
|
|
|
|
statement in the all files that have that. Controllers should pick |
|
141
|
|
|
|
|
|
|
a default that h2xs would have generated for Perl version 5.8 or later. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Example: |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
copyright_holder `Your Company Inc.`; |
|
146
|
|
|
|
|
|
|
license_text `All rights reserved.`; |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Example output: |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Copyright (c) 2005 Your Company Inc. |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
All rights reserved. |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item location |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Base url for the application. Normally, this applies only to httpd.conf |
|
157
|
|
|
|
|
|
|
and things like it. We need it here to generate tests. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=back |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 KEYWORDS in controller blocks |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
The simple statement keywords available in controller blocks are |
|
164
|
|
|
|
|
|
|
(all of these are optional): |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=over 4 |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item controls_table |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
This is the name of the table which this controller controls. It must |
|
171
|
|
|
|
|
|
|
be defined in a table block somewhere in the bigtop file. |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item uses |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
A comma separated list of modules which the controller should include with |
|
176
|
|
|
|
|
|
|
Perl use statements. There is not currently a way to limit what these |
|
177
|
|
|
|
|
|
|
modules export, except by editing the generated stub. |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item text_description |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
This is a short phrase that describes the rows of the table. It will |
|
182
|
|
|
|
|
|
|
usually become the return value of get_text_description (a class accessor). |
|
183
|
|
|
|
|
|
|
For example, Gantry's AutoCRUD uses this in user messages. |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=item rel_location |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
The location (URL suffix) relative to the base location of the application, |
|
188
|
|
|
|
|
|
|
which will hit a given controller. This keyword is primarily for httpd conf |
|
189
|
|
|
|
|
|
|
and the like, but we need it here to generate tests. |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=item location |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
The location (URL) which will hit a given controller. This keyword is |
|
194
|
|
|
|
|
|
|
primarily for httpd conf and the like, but we need it here to generate tests. |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=back |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Note that some other backend types also look for information in controller |
|
199
|
|
|
|
|
|
|
blocks. Pay particular attention to HttpdConf backends. They typically |
|
200
|
|
|
|
|
|
|
expect a location or rel_location keyword which becomes the Apache Location |
|
201
|
|
|
|
|
|
|
for the controller. |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head1 METHODS for Control backends |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=over 4 |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=item is_controller_keyword |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Parameters: a word which might be a controller keyword |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Returns: true if it is a controller keyword, false otherwise |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=back |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=head1 AUTHOR |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
Phil Crow |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=head1 COPYRIGHT and LICENSE |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
Copyright (C) 2005 by Phil Crow |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
224
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.6 or, |
|
225
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=cut |