Author: stas Date: Tue May 10 19:13:36 2005 New Revision: 169558 URL: http://svn.apache.org/viewcvs?rev=169558&view=rev Log: ModPerl::RegistryCooker::chdir_file_normal() now chdirs to the current script's directory or the specified directory as an argument, as it was planned in first place. Therefore switch ModPerl::Registry and ModPerl::PerlRun to us NOP for this method call. If chdir_file is mapped to chdir_file_normal(), then run() and convert_script_to_compiled_handler() now call chdir to the script's directory and at before returning go back to the server root.
Modified: perl/modperl/trunk/Changes perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/PerlRun.pm perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/Registry.pm perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm Modified: perl/modperl/trunk/Changes URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=169558&r1=169557&r2=169558&view=diff ============================================================================== --- perl/modperl/trunk/Changes (original) +++ perl/modperl/trunk/Changes Tue May 10 19:13:36 2005 @@ -12,6 +12,14 @@ =item 1.999_24-dev +ModPerl::RegistryCooker::chdir_file_normal() now chdirs to the current +script's directory or the specified directory as an argument, as it +was planned in first place. Therefore switch ModPerl::Registry and +ModPerl::PerlRun to us NOP for this method call. If chdir_file is +mapped to chdir_file_normal(), then run() and +convert_script_to_compiled_handler() now call chdir to the script's +directory and at before returning go back to the server root. [Stas] + prevent undef warnings in catfile() calls in Apache2::Build when called from the ModPerl-Registry tree [Stas] Modified: perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/PerlRun.pm URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/PerlRun.pm?rev=169558&r1=169557&r2=169558&view=diff ============================================================================== --- perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/PerlRun.pm (original) +++ perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/PerlRun.pm Tue May 10 19:13:36 2005 @@ -52,7 +52,7 @@ read_script => 'read_script', shebang_to_perl => 'shebang_to_perl', get_script_name => 'get_script_name', - chdir_file => 'chdir_file_normal', + chdir_file => 'NOP', get_mark_line => 'get_mark_line', compile => 'compile', error_check => 'error_check', Modified: perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/Registry.pm URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/Registry.pm?rev=169558&r1=169557&r2=169558&view=diff ============================================================================== --- perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/Registry.pm (original) +++ perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/Registry.pm Tue May 10 19:13:36 2005 @@ -52,7 +52,7 @@ read_script => 'read_script', shebang_to_perl => 'shebang_to_perl', get_script_name => 'get_script_name', - chdir_file => 'chdir_file_normal', + chdir_file => 'NOP', get_mark_line => 'get_mark_line', compile => 'compile', error_check => 'error_check', Modified: perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm?rev=169558&r1=169557&r2=169558&view=diff ============================================================================== --- perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm (original) +++ perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm Tue May 10 19:13:36 2005 @@ -26,6 +26,7 @@ our $VERSION = '1.99'; +use Apache2::ServerUtil (); use Apache2::Response (); use Apache2::RequestRec (); use Apache2::RequestUtil (); @@ -40,7 +41,7 @@ use ModPerl::Global (); use File::Spec::Functions (); -use File::Basename; +use File::Basename (); use Apache2::Const -compile => qw(:common &OPT_EXECCGI); use ModPerl::Const -compile => 'EXIT'; @@ -62,7 +63,6 @@ # the debug level can be overriden on the main server level of # httpd.conf with: # PerlSetVar ModPerl::RegistryCooker::DEBUG 4 -use Apache2::ServerUtil (); use constant DEBUG => 0; #XXX: below currently crashes the server on win32 # defined Apache2->server->dir_config('ModPerl::RegistryCooker::DEBUG') @@ -235,7 +235,7 @@ $self->flush_namespace; - #XXX: $self->chdir_file("$Apache2::Server::CWD/"); + $self->chdir_file(Apache2::ServerUtil::server_root()); return $rc; } @@ -406,7 +406,7 @@ return $rc unless $rc == Apache2::Const::OK; $self->debug(qq{compiled package \"$self->{PACKAGE}\"}) if DEBUG & D_NOISE; - #$self->chdir_file("$Apache2::Server::CWD/"); + $self->chdir_file(Apache2::ServerUtil::server_root()); # if(my $opt = $r->dir_config("PerlRunOnce")) { # $r->child_terminate if lc($opt) eq "on"; @@ -618,7 +618,9 @@ sub chdir_file_normal { my($self, $dir) = @_; - # $self->{REQ}->chdir_file($dir ? $dir : $self->{FILENAME}); + $dir ||= File::Basename::dirname($self->{FILENAME}); + $self->debug("chdir $dir") if DEBUG & D_NOISE; + chdir $dir or die "Can't chdir to $dir: $!"; } #########################################################################