Right. The examples you've found are from mod_perl 1, Apache2 has this in its docs:
/** * Retrieve the document root for this server * @param r The current request * @warning Don't use this! If your request went through a Userdir, or * something like that, it'll screw you. But it's back-compatible... * @return The document root * @deffunc const char *ap_document_root(request_rec *r) */ AP_DECLARE(const char *) ap_document_root(request_rec *r);
we haven't had a chance yet to work on figuring out how to solve it for mp2. Let me do some research and I'll be back to you shortly.
in mp1 $r->document_root is misleading in the sense that it is _not_ locally scoped to $r - if you set it the change remains for all subsequent requests, since you are really altering the core configuration data. any example you find for mp1 _should_ include a mechanism for resetting $r->document_root to it's original value or it's misleading at best. something like this
http://www.modperlcookbook.org/code/ch04/Cookbook/Userdir.pm
is more proper than what you have.
being able to alter DocumentRoot is valuable as long as you understand the ramifications, so I see no reason why we shouldn't continue to make it a writable feature in mp2. however, I very much dislike having it hang off of $r and would prefer it to hang off of $s so that people understand that its lifetime extends beyond the current request.
+1
the bigger problem (which i've explained on the dev list) in the parallel thread, is that under threaded mpms, that changing the document_root in one thread will affect all other threads, which is most certainly break things. So unless I'm missing something, that won't work for worker mpm.
At the moment we have about 10 methods, which access server global structures and if you use those to set those structures, you limit your users to non-threaded mpms.
-- __________________________________________________________________ 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
-- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html