[cgiapp] a CGI::Application::Dispatch problem

Michael Peters mpeters at plusthree.com
Wed Jan 14 09:13:09 EST 2009


ximiff wrote:
> hi all,
> 
> directory /cgi-bin/test/ has two files , test_ca.pm and test_ca.cgi
> 
> <code>
> #test_ca.pm
> package test_ca;
> use strict;
> use warnings;
> use Data::Dumper;
> use base 'CGI::Application';
> sub setup
> {
> my $self = shift;
> $self->mode_param('rm');
> $self->start_mode('showform');
> $self->run_modes([qw/do1 do2 do3/]); 
> }
> sub cgiapp_postrun {
> my $self = shift;
> $self->header_add( -charset => 'gbk' );
> }
> sub do1
> {
> return '<html><body><p>do1</p></body></html>';
> }

No offence, but you might want to look at something like perltidy to put some sane indentation in 
that code :)

> #test_ca.cgi
> use base 'CGI::Application::Dispatch';
> CGI::Application::Dispatch->dispatch(
>         prefix              => '',
>         table               => [
>             ':app/:rm'  => { },
>         ],
> # debug => 1,

I see you've commented out the debug. What get's printed to the log if you don't?

> now i visit the url http://mywebsite/cgi-bin/test/test_ca.cgi/test_ca/do1 ,and browser returned "404 not found".
> this is my first time to use CGI::Application::Dispatch moudle, and i need your help.

What web server are you running this on?

-- 
Michael Peters
Plus Three, LP



More information about the cgiapp mailing list