[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgiapp] CAP Application Design suggestion


Hi...

I came up with the a specific design about an application I'm writing using CGI::Application. Here is an example:

MyBaseApp    is-a         CGI:App
MyApp            is-a         MyBaseApp
Cars                is-a          MyApp
Airplanes         is-a          MyApp

Both Cars and Airplanes implement a runmode named: 'registration'

I want to be able to call the right 'registration' runmode, according to one query param (for example, 'type') that user requests. Example the "http://www.example.com/app.pl?rm=registration&type=car"; to be handled by the Cars 'registration' runmode.

I thought to do that in app.pl script (the instantiation script):
1. Use plain CGI to check for the 'type' query parameter
2. Do a simple dispatch like:
  my $app = undef;
  $app = Cars->new() if $type eq "car";
  $app = Planes->new() if $type eq "planes";
  $app->run();

I'm wondering if they are better ways to do the above (maybe inside a CAP, without using the plain CGI for checking the 'type' param). Any suggestions or ideas (always for a persistent environment like mod_perl) are welcome...

Regards,
Giannis


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.