> 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. --Geoff -- 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