If I rename dispatch.cgi to dispatch.pl that gets rid of the need for the trailing '/blah'.

And if I change the default route to '/dispatch.pl/' then it matches - is that by design? I expected the dispatch.pl to get stripped out before the route matches.

Cheers,

Patrick

On Tue, Jun 1, 2010 at 12:15 AM, Patrick Donelan <pat@patspam.com> wrote:
Hi Dancer people,

I was playing with Dancer today, trying to work out the right recipe to get it running smoothly on a shared hosting account (documented here).

I started with trying to get Dancer running in CGI mode, but for some reason I could get it to accept requests to '/', e.g. http://domain/dispatch.cgi/
Whenever I request that, it returns the contents of dispatch.cgi, even with the default route changed to r('.*'). Whereas requests to /dispatch.cgi/blah work fine.

Sounds like an Apache problem right? The bizarre thing is that other simple plack CGI scripts work fine, and if I actually put a Data::Dumper::Dumper($env) into app.psgi, it actually dumps out the env hash (before returning the contents of dispatch.cgi), which seems to indicate it's actually running the script, but then bailing out or something.

In case it helps, the dumped contents of $env are:

{
'psgi.multiprocess' => 1,
'SCRIPT_NAME' => '/dispatch.cgi',
'PATH_INFO' => '/',
'HTTP_ACCEPT' => 'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
'REQUEST_METHOD' => 'GET',
'PERL_MM_OPT' => 'INSTALL_BASE=/home1/muscleca/perl5',
'psgi.multithread' => 0,
'SCRIPT_FILENAME' => '/home1/muscleca/public_html/perlsharedhosting/dispatch.cgi',
'SERVER_SOFTWARE' => 'Apache/2.2.15 (CentOS) mod_ssl/2.2.15 0.9.8l DAV/2 mod_auth_passthrough/2.1 FrontPage/5.0.2.2635',
'PLACK_ENV' => 'development',
'HTTP_USER_AGENT' => 'Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.55 Safari/533.4',
'REMOTE_PORT' => '50243',
'QUERY_STRING' => '',
'HTTP_PRAGMA' => 'no-cache',
'SERVER_SIGNATURE' => '<address>Apache/2.2.15 (CentOS) mod_ssl/2.2.15 0.9.8l DAV/2 mod_auth_passthrough/2.1 FrontPage/5.0.2.2635 Server at hostmonster.perlsharedhosting.com Port 80</address>
',
'HTTP_CACHE_CONTROL' => 'no-cache',
'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8',
'psgi.streaming' => 1,
'PERL5LIB' => '/home1/muscleca/perl5/lib/perl5:/home1/muscleca/perl5/lib/perl5/x86_64-linux-thread-multi',
'PATH' => '/home1/muscleca/perl5/bin:/usr/local/bin:/usr/bin:/bin',
'GATEWAY_INTERFACE' => 'CGI/1.1',
'psgi.version' => [
1,
1
],
'DOCUMENT_ROOT' => '/home1/muscleca/public_html/perlsharedhosting',
'psgi.run_once' => 1,
'PATH_TRANSLATED' => '/home1/muscleca/public_html/perlsharedhosting/dispatch.cgi/',
'MODULEBUILDRC' => '/home1/muscleca/perl5/.modulebuildrc',
'UNIQUE_ID' => 'TASHmkrc13MAAGkor0AAAAnZ',
'SERVER_NAME' => 'hostmonster.perlsharedhosting.com',
'HTTP_ACCEPT_ENCODING' => 'gzip,deflate,sdch',
'SERVER_ADMIN' => 'webmaster@perlsharedhosting.musclecarwebdesign.com',
'HTTP_CONNECTION' => 'keep-alive',
'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
'SERVER_PORT' => '80',
'HTTP_COOKIE' => '__utmz=226470915.1275355275.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=226470915.680138832.1275355275.1275355275.1275357426.2; __utmc=226470915',
'REMOTE_ADDR' => '96.232.149.145',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'psgi.errors' => *::STDERR,
'REQUEST_URI' => '/',
'psgi.nonblocking' => 1,
'SERVER_ADDR' => '74.220.207.74',
'psgi.url_scheme' => 'http',
'HTTP_HOST' => 'hostmonster.perlsharedhosting.com',
'psgi.input' => *::STDIN
};


Thanks,

Patrick