ColinB wrote:
--- Stas Bekman <[EMAIL PROTECTED]> wrote:

... I won't commit it yet, but you can override it in your

startup.pl,


until the dust settles down:

require Apache::compat;
sub Apache::RequestRec::chdir_file {
    my $dir = @_ == 2 ? $_[1] : $_[0]->filename;
    chdir $dir;
}


Thanks Stas. However, this seems to set the working directory to the
server root, not the cgi-bin directory where the script resides.

right, here is another try, again untested:


Index: lib/Apache/compat.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
retrieving revision 1.86
diff -u -r1.86 compat.pm
--- lib/Apache/compat.pm        28 Jul 2003 10:33:58 -0000      1.86
+++ lib/Apache/compat.pm        29 Jul 2003 13:31:24 -0000
@@ -40,6 +40,8 @@
 use mod_perl ();
 use Symbol ();

+use File::Basename ();
+
 BEGIN {
     $INC{'Apache.pm'} = __FILE__;

@@ -335,6 +337,9 @@

 sub chdir_file {
     #XXX resolve '.' in @INC to basename $r->filename
+    my $file = @_ == 2 ? $_[1] : $_[0]->filename;
+    my $dir = File::Basename::basename($file);
+    chdir $dir or die "Can't chdir to $dir: $!";
 }

sub finfo {


__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com



Reply via email to