[cgiapp] Re: Question regarding Dispatcher & CGI::Application::Dispatch 2.13_01

Michael Peters mpeters at plusthree.com
Wed Apr 9 09:33:53 EDT 2008


Karunakar Komirishetty wrote:
> Hello Michael - 
> 
> I sent you an email yesterday regarding the dispatcher. I wanted to clarify more in this email. This is what I am trying to do. My basic URL would look like one of these:
> 
> http://test.net:8080/gigservices/Brand?132022
> http://test.net:8080/gigservices/Device?ID=10&name=apple

Are you using mod_perl or plain CGI? If mod_perl, then you have move flexibility
 for setting some things up.

> In the above URL, Brand and Device are perl modules. 

Then they are your ":app" in Dispatch rules. And are the module's packages
really "Brand" and "Device"? No other project specific namespace?

>"gigservices" is not a directory.

If you are under mod_perl, then you can just make "gigservices" your <Location>
block from which you serve. Otherwise you'll need to do some mod_rewrite magic
stuff. Of if you aren't even using Apache or can't control your configuration
then I'm not sure Dispatch can be of much help. Translating URLs to resources is
part of the web server's job. Dispatch just helps to translate the rest of the
url into something C::A can use.

> I just wanted the URL to be that way. I don't have a run mode in the URL. Based
> on the request being a GET or POST, I want to pass it to get and post run modes 
> inside respective perl modules.
> 
> How can I achieve your Dispatcher module? Any help on this would be great. 

I would think a dispatch table like this (untested) would do what you want
(minus the "gigservices" bit. That will depend on how you have your web server
configured as I said above):

':app[get]'  => { rm => 'get_rm' },
':app[post]' => { rm => 'post_rm' },

> I tried to use CPAN to install "CGI::Application::Dispatch 2.13_01" on one my 
> other machine. For some reason it errored out. Do you recommend a manual 
> installation i.e downloading and unzipping the file manually?

"errored out" is not very descriptive. It's hard to give advice on what to do
next without knowing more.

-- 
Michael Peters
Plus Three, LP



More information about the cgiapp mailing list