Internal Of CGI Process
Method
FML::CGI class should implement the following methods:
html_start()
run_cgi_main()
run_cgi_title()
run_cgi_navigator()
run_cgi_menu()
run_cgi_command_help()
run_cgi_options()
html_end()
where
html_start() prints out the header of HTML such as DOCTYPE ... BODY,
html_end() prints /BODY and /HTML.
run_XXX methons prints the main content.
run() of $curproc method drives
html_start()
run_cgi_XXX()
html_end()
sequentially.
That is, the flow of CGI process is as follows:
new()
prepare()
verify_request()
run()
html_start()
run_cgi_XXX()
html_end()
finish()
Screen Of CGI And The Method
&fml8; CGI script creates the screen:
header
space menu space
bar 1 main bar 2
space menu space
footer
The bar 1 and 2 are called as navigation bar.
html_start() generates header part(DOCTYPE ... BODY of HTML, NOT HTTP
HEADER). html_end() generates footer part.
Instead, BODY content generates 3 x 3 tables by using methods drived
by run_cgi().
9 sub methods called by run_cgi() generetes the following 9 pieces on
the screen.
nw north ne
west center east
sw south se
Screen Of The Current CGI
CGI screen generates 3 x 3 table structure.
The following methods generates the corresponding part of the screen.
run_cgi_main
run_cgi_title
run_cgi_navigator run_cgi_menu run_cgi_command_help
run_cgi_options
These methods use TABLE to create 3 x 3 matrix.
These methods are defined in hash table.
run_cgi() executes them sequentially.
run_cgi_main() print nothing if nothing to do.
In almost cases, print just "OK ..." message.
If needed, it shows error messages.
run_cgi_main() runs before all other methonds to
print out the latest information.
run_cgi_main() is adapter layer defined at FML::CGI::Menu::Admin.
Each command is executed via this layer.
In a few cases such as showing log, listing up addresses,
run_cgi_menu() print out the data.
Screen And Trampolin Mechanism
CGI print engine is moved to
FML::Command:: class.
However FML::Command:: does not contains all content of print engine.
By object composition,
some modules use methods FML::CGI:: provides.
For example, subscribe command internal is as follows.
FML::CGI::Admin::Main ->
FML::Command::Admin::subscribe ->
FML::CGI::Admin::User ->
SCREEN
The flow goes and back again like trampolin mechanism.
MISC: Hard Coding Is Mandatory ?
FML::CGI::Admin::User contains the relation between $comname and maps.
It is hard-coded. But it cannnot be avoided.
If we move the relation to configuration space,
we need a lot of variables in it.
It is better to use configuration variables for cusotomization,
but ...
§.internal.cgi.examples;