[cgiapp] Re: CGI::Application::Dispatch help

fREW Schmidt frioux at gmail.com
Mon Jan 19 15:42:50 EST 2009


> Well, I'm not sure why, but Apache is doing something weird here. Is this a
> Windows problem (did someone else in this thread point out that it works
> right on Ubuntu)?

It may be a windows issue, although it doesn't seem like some weird
obscure bug...

> You could try just putting in your own dispatch_path() method in your
> Dispatch class to strip out the first directory part of the PATH_INFO.

Sounds good to me!  Check it out:

#{{{ Aircraft Ducting
<VirtualHost *:8080>
   ErrorLog "C:/Documents and Settings/frew/My
Documents/Code/aircraft_ducting/logs/error.log"
   <Perl>
      use lib 'C:/Documents and Settings/frew/My
Documents/Code/aircraft_ducting';
      $ENV{MODE} = 'development';
   </Perl>
   Alias /js  "C:/Documents and Settings/frew/My
Documents/Code/aircraft_ducting/js"
   <Location  /ACD>
      SetHandler perl-script
      PerlHandler ACD::Dispatch
       Order allow,deny
       Allow from all
   </Location>
</VirtualHost>
#}}}

package ACD::Dispatch;
use base 'CGI::Application::Dispatch';
use warnings;

sub dispatch_path {
    if ($ENV{PATH_INFO} =~ /\/htdocs\/ACD(.*)/) {
        return $1;
    } else {
        return $ENV{PATH_INFO};
    }
}

sub dispatch_args {
    warn "Path Info: $ENV{PATH_INFO}";
    return {
        prefix  => 'ACD',
        debug => 1,
        table   => [
            ''                => { app => 'Controller', rm => 'awesome' },
            ':app/:rm?/:id?'        => { },
            #'/station/:rm'  => { app   => 'ACD::Controller::Station' },
        ],
        args_to_new => {
            PARAMS => {
                cfg_file => 'C:/Documents and Settings/frew/My
Documents/Code/aircraft_ducting/config.pl',
            }
        },
    };
}

1;

This seems to work fine.  Thanks a lot!

-- 

-fREW


More information about the cgiapp mailing list