Vitaliy Babiy wrote:
Hello folks
I am starting a new project today which is going to have more 200 run modes, and I would
like to break things up.
Good idea.
But I'd like to have single CGI script that handles every request to the
application.
I also need to have centralized list of all run modes from every module.
Just out of curiosity, why do you want just one cgi script? Just seems
to me like an unnecessary thing that overly complicates your
application. Instead of just executing that scripts C::A you throw one
more layer into the mix. This will complicate things in the design as
well as slow things down in the execution. Just wondering why?
I'm going to have some kind of config where to store all run modes with information
where every sub is located, something like this:
#run-mode:module:sub
1:Module01:hello
2:Module01:show_some_form
3:Module02:show_another_form
4:Module03:do_something
Which means if we call script.cgi?rm=2, sub show_some_form() from Module01.pm should
be executed.
Next. I suppose I will have one base class which will be called form CGI script.
This class will have only one run-mode, which will load config and determine, which module to load
and which sub to execute.
And here I get stuck... I'm not sure how to do that.
Does anyone have some kind of related experience?
I am interested in knowing what others think about this approach.
Any advice appreciated.
If you are really stuck on doing it this way I would suggest that your
script should create a CGI query object, figure out the run mode, read
the config file, grab the module and the run mode from the config,
'require' the appropriate module, change the 'rm' parameter in the CGI
params, then create an instance of the required module passing as the
value of the QUERY param the CGI query object you just created. Then
call that objects 'run()' method.
Does that make sense?
Michael Peters
Developer
PlusThree
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]