On Fri, 2003-10-17 at 13:07, Geoffrey Young wrote:
> simran wrote:
> > Hi All,
> >
> > I have a PerlTransHandler where i am doing something to the effect of:
> >
> > my $request = instance Apache::Request(shift);
> > $request->document_root("/home/testuser/www");
> > $request->pnotes("test_key" => "test_value");
> > warn "Set document root to /home/testuser/www\n";
> >
> > Then later in a PerlHandler (in the same request) i am doing:
> >
> > my $request = instance Apache::Request(shift)
> > my $root = $request->document_root();
> >
> > warn "DocRoot=$root\n";
> > my $value = $request->pnotes("test_key");
> > warn "TEST VALUE = $value\n";
> >
> > =====================================================================
> >
> > In my apache error log i get:
> >
> > *** Set document root to /home/testuser/www
> > *** DocRoot=/home/simran/www
> > *** TEST VALUE = test_value
> >
> > (/home/simran/www was the document root before i changed it in my
> > PerlTransHandler).
> >
> > I'm fairly sure that i am looking at the same request object across the
> > PerlTransHandler and PerlHandler as the $r->pnotes has the key/value i
> > set (in the PerlTransHandler) still set in the PerlHandler...
> >
> > Can anyone advise on how i can debug this further to see what might be
> > happening... there is no other handlers between the above two (so no
> > chance of another handler changing the document root back to the
> > original again).
>
> yike.
>
> try using just the passed in Apache object instead of the cached instance
> object and see what happens. something is definitely amuck.
Tried that... (new Apache::Request(shift)) but same result
unfortunately...
>
> >
> > I am using: Apache/1.3.27 (Unix) mod_ssl/2.8.14 OpenSSL/0.9.6c DAV/1.0.3
> > mod_perl/1.28, perl 5.8.0
> >
> > Any help greatly appreciated.
> >
> > simran.
> >
> > ps: I believe (if my memory serves me right) that the above used to work
> > okay under an older version of mod_perl/apache/perl... (and have not got
> > the environment to test it in again!).
>
> well, sort of. in previous versions of apache it was possible to set
> $r->document_root. however, any changes made to $r->document_root would
> persist for the entire life of the child, not just the life of the current
> request. for that reason, you were expected to always restore the value of
> $r->document_root to its original state.
>
> see recipe 4.3 in the cookbook
>
> http://www.webreference.com/programming/perl/cookbook/chap4/2.html
> http://www.modperlcookbook.org/code/ch04/Cookbook/Userdir.pm
Thanks for those... those are the exact ones i have followed. I had
mailed a question about document_root a few months ago and upon your
advice then, i had followed those exact recipes (and my code for the
most part of my subroutine is a copy/past job from the above URL's -
including the PerlCleanupHandler... )
any other ideas on how i can debug this would be greatly appreciated...
simran.
>
> I'm not aware of any changes in apache that would make this no longer true,
> but you never know...
>
> --Geoff