[cgiapp] Can I override CAP::Dispatch::dispatch_path() ?

silent silent2600 at gmail.com
Sat Mar 21 09:49:32 EDT 2009


Hi,

I want to override dispatch_path() with FastCGI,
because some http server does not set the $ENV{PATH_INFO},
I want to set it by my self,
but it seems not work, all the request goto the default app default run_mode.


package Mydispatch;
use base 'CGI::Application::Dispatch';

sub dispatch_path {
    my $uri = $ENV{'REQUEST_URI'};
    my $name = $ENV{'SCRIPT_NAME'};

    $uri =~s/^$name//;
    $uri =~s/\?.*$//;
    $ENV{'PATH_INFO'} = $uri;
    warn "[+] $uri\n";    ### the warn only print for one time when I
start the script.
    return $uri;
}

sub dispatch_args {
    return {
        prefix => 'APP::User',
        table  => [
            ''              => { app => 'Foo' },   #### always here.
            ':app/:rm'      => {},
            ],
    };
}
1;


the APP::User.pm  has  use base 'CGI::Application::FastCGI';
and it seems to be a perl problem, not a CAP-dispatch problem, but I
can not fix it right now.

thanks!


More information about the cgiapp mailing list