On Wed, Aug 18, 2004 at 09:36:45AM -0400, Dave Della Costa wrote:
Wow, I just got back in the office and I see I sparked quite a discussion! I had suspected that this feature was specific to the first version of mod_perl, alas...
A little background: what I have been trying to do is essentially reset document_root for a set of rewrite rules that I want to drop into place for our developers who are using dynamic vhosts. The inability for our team to use the rewrite rules that are present in the live application makes our testing and QA environments incomplete. So I had hoped to not sacrifice the great benefits of dynamic vhosts while being able to include without modification the same rewrite rules that we use in our live applications. Because I do not want to modify the rewrite rules, I've been wanting to alter document_root for the lifetime of the request with the idea that the rewrite rules would execute with this new document_root (I had also assumed that I would be alright to leave document_root altered, as it would be re-evaluated upon every request). I found myself pushing the limits of what mod_rewrite could do (I think...I'm still skeptical of that, considering mod_rewrite's power), and turned to mod_perl for help.
Apparently this is not so simple no matter what technology one uses!
Apache caches the server_rec, so as Stas said, modifying it affects things globally, and across the request. In C, if I wanted to local'ize the server_rec for the request, I would make a copy of the server_rec, store it in r->server, and then modify its contents (top-level only) through r->server.
Stas: is there a way to do this in mod_perl? What do you think of local'izing the server_rec when an application attempts to make request-specific changes? There would need to be a clear API for making request-specific or global changes. (Changes through r->server instead of directly through the global server rec, e.g. in the main httpd.conf) Maybe pass $r as an arg to the server_rec method if you want it local'ized? Just musing ...
Hmm, how do you see that idea working, Glenn? even if we could localize server_rec, the rest of the Apache will still see the un-localized one, so we don't achieve much. If you wanted to change things just for the mod_perl handlers scope, just stick a new docroot in some singleton and use that in your code.
-- __________________________________________________________________ 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