On 30 Mar 2006 at 9:23, Prakash Inuganti -X (pinugant - Digital-X,[cgiapp] How to split runmodes into different mod wrote:
> My question may sound very basic on this alias but I do need some > guidance here. I have seen discussion on this alias about splitting > runmodes into different modules. But I still could not figure out how > these different modules can be linked together again for the same > Application. Well, this was exactly my problem ;-) and I am still very much feeling my way in the dark. > I have an Application.pm with all the runmodes in Setup() and an > Instance Script that has > My $app = Application->new(); > $app->run(); > > Now How do I split the runmodes into different modules and what would be > my instance script and how do I link all of them together. Can you > please point me to any examples or tutorials that can help me figure > this out. I see two possibilities. Either you just create multiple instance scripts, each for one sub- application or you can do it with one instance script if you use CGI::Application::Dispatch. The overall structure is the same in both cases. You usually have a base class with all the common stuff in it, like loading plugins, setting up the templating system, taking care of authentication, session stuff and so on. Then I have several sub-applications, all inheriting from the base class, say one for customers, one for products. The customer class would have runmodes like add_customer, edit_customer, show customers and perhaps something like a special runmode "all my very best customers I want to invite to the football world championship final Germany-Brasil" ;-) Each runmode usually comes in a display and a process variant. The different sub-applications are connected through links. E.g. I could have some links on one of the customer pages to all the products the customer bought in the past. Such a like might look like "/cgi-bin/products.pl?rm=show_product&id=5" or '/business/product/5' if you use CA::Dispatch and perhaps a little bit of mod_rewrite. The only difficulty is, if you want a cross-sub-application connection not by a link but through a form submission. That was my problem the other day. I really don't know if this kind of layout will lead to major problems or is somewhat proven and recommended. My current project is the first of such a size that I didn't want everything in one class and in one file, it just looked very messy, so I tried to tidy it up a bit. HTH, Michael --------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/cgiapp@lists.erlbaum.net/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]