Subject: | Win32 compatibility/platform independence and Plack::Server deprecated |
Hi,
I got the module working under Ubuntu Linux and partially working on
Windows Vista but on Win32 when I tried to bring up the index URL (eg
http://localhost) I got the "No .psgi file found" error. On looking
into the problem I noticed that _resolve_app_filename was assuming that
the path separator for the PATH_TRANSLATED was the forward '/' which is
not true on Win32 Apache 2.X where you get '\' backslash separators.
So this patch uses File::Spec to split up and rejoin path segments
until it finds the longest path section that maps to a file. This
should make _resolve_app_filename more platform independent.
I am new to Plack but noticed in the docs that the Plack::Server
modules, referred to in your POD, are now deprecated. So this patch
includes about two lines that change the Plack::Server references to
Plack::Handler and I have tested with the changed psgi.fcgi and it
seems to work.
The patch has been tested under Windows Vista with Strawberry Perl 5.12
and Apache 2.2 and Ubuntu 8.04 with Perl 5.8.8 and Apache 2.2.8.
Good luck and thanks for the module,
Ron
Subject: | ActionWrapper.pm.patch |
10c10
<
---
> use File::Spec;
59a60,62
> my ($vol, $pt_dir) = File::Spec->splitpath($path_translated);
> my @path_parts = File::Spec->splitdir($pt_dir);
>
61,64c64,68
< my @path_parts = split(m{/}, $path_translated);
< while ( ! -r join("/", @path_parts) ) {
< last if @path_parts == 0; # Break out if we're at the end
< pop @path_parts;
---
> while ( not -r $path_translated and @path_parts ) {
> my $f = pop @path_parts;
> $path_translated = File::Spec->catpath(
> $vol, File::Spec->catdir(@path_parts), $f
> );
67,74c71
< # Return undef (that is, no app) if no path part was a readable file
< return if @path_parts == 0;
<
< # Execute the contents of the file and return last variable defined in it
< my $psgi_file = join("/", @path_parts );
<
< # Cache the app to allow persistent running
< return $psgi_file;
---
> return -r $path_translated && $path_translated;
166,167c163,164
< use Plack::Server::FCGI;
< Plack::Server::FCGI->new->run($app);
---
> use Plack::Handler::FCGI;
> Plack::Handler::FCGI->new->run($app);