[cgiapp] Re: Dispatcher
Michael Peters
mpeters at plusthree.com
Thu Jan 31 14:46:43 EST 2008
Karunakar Komirishetty wrote:
> Hello Michael
CC'ing the C::A list
> My name is Karun. I am trying to implement the CGI-Application-Dispatch-2.12 module which you developed. I downloaded and installed the module. In my application I am subclassing the dispatch_args subroutine. When I run the URL I get a page not found error (404). I am using Apache server and mod_perl 2.0. My URL looks something like the following:
>
> http://example.net:4042/WebApp/WebService/mode_get_page
>
> For some reason it's failing in the table code. The following is the table code:
>
> sub dispatch_args {
> my $self = shift;
> my $DEBUG = true;
> my ( $self1, $new_args ) = @_;
>
> return {
> prefix => 'WebApp',
> table => [
> '/WebService' => { app => 'WebService', rm => 'mode_get_page' },
> ],
> #error_document => '"Oops..."',
> #default => 'Test.html',
> $DEBUG => 'true',
> };
>
> }
I'll need a little more info than that. Are you using Apache? mod_perl?
mod_rewrite? If so, how are they configured for this location. Also, what C::A
module are you trying to dispatch to?
Also, I think you might be confused about what some of those values should be.
The 'prefix' isn't the URL prefix, it's the module name prefix. C::A::Dispatch
dispatches to C::A based modules. Also the url's are assumed to be all
lowercase. Look at the translate_module_name() name if you want to change this.
Looking at the URL you have and the, the prefix and the table your url will map
to a class named WebApp::Webservice. Does that module exist?
Also you seem to be a little confused about that $DEBUG there. For one, "true"
is can't exist without quotes (like you have in "my $DEBUG = true;" Perl doesn't
have true/false literals like that. Use 1 or 0. And then in your hash that you
return you have "$DEBUG => 'true'", that will not do what you think it will. Try
'debug => 1'.
--
Michael Peters
Developer
Plus Three, LP
More information about the cgiapp
mailing list