virtualhost based variables

2002-10-02 Thread Alan

Greetings again.

I'm trying to figure out the best/fastest/most elegant way of setting
virtualhost based variables.  Basically I have three sites, and the only
difference between them is the DocumentRoot ($htdocroot) and the database
their data is being accessed from ($dbh).

When it was a single site I had $documentroot and $dbh declared in my 
startup.pl, and my modules accessed it through $main::dbh, and it was
all find and dandy.  

Is there a way to do this? Or do I have to use $r-dir_config in every
module to get the document root and re-create $dbh? 

I know mod_perl 2.0 will solve this problem with the +Parent option, but
heading to apache 2.0 might not be an option at this point.

So how does everyone else do it? :)

TIA

alan

-- 
Alan Arcterex [EMAIL PROTECTED]   -=][=-   http://arcterex.net
I used to herd dairy cows. Now I herd lusers. Apart from the isolation, I
think I preferred the cows. They were better conversation, easier to milk, and
if they annoyed me enough, I could shoot them and eat them. -Rodger Donaldson



Re: virtualhost based variables

2002-10-02 Thread James G Smith

Alan [EMAIL PROTECTED] wrote:
Greetings again.

I'm trying to figure out the best/fastest/most elegant way of setting
virtualhost based variables.  Basically I have three sites, and the only
difference between them is the DocumentRoot ($htdocroot) and the database
their data is being accessed from ($dbh).

Document root should be accessable from $r.

I would use Apache::DBI for persistent connections.  Then connect at
the beginning of the request with the DBI connection parameters
coming from $r-dir_config.
-- 
James Smith [EMAIL PROTECTED], 979-862-3725
Texas AM CIS Operating Systems Group, Unix



Re: virtualhost based variables

2002-10-02 Thread Alan

On Wed, Oct 02, 2002 at 06:04:03PM -0500, James G Smith wrote:
 Alan [EMAIL PROTECTED] wrote:
 Greetings again.
 
 I'm trying to figure out the best/fastest/most elegant way of setting
 virtualhost based variables.  Basically I have three sites, and the only
 difference between them is the DocumentRoot ($htdocroot) and the database
 their data is being accessed from ($dbh).
 
 Document root should be accessable from $r.
 
 I would use Apache::DBI for persistent connections.  Then connect at
 the beginning of the request with the DBI connection parameters
 coming from $r-dir_config.

Yup, and this is exactly how I have it working right now.  Each module
starts by re-instantiating $dbh and $htdocroot via dir_config and a
function that uses dir_config to find the database it's supposed to grab
stuff from.

The problem is that it seems like I've incurred a pretty high speed
penalty, and my requests/sec have dropped from about 165 to 83 :(  I'm
still pushing enough data to saturate a T1, so at the end it's not 
going to be a noticable difference.  I wanted to know if there was a
better/faster way to do this though, without having to call $r-dir_config
and $r-document_root for /every/ request.

Alan

-- 
Alan Arcterex [EMAIL PROTECTED]   -=][=-   http://arcterex.net
I used to herd dairy cows. Now I herd lusers. Apart from the isolation, I
think I preferred the cows. They were better conversation, easier to milk, and
if they annoyed me enough, I could shoot them and eat them. -Rodger Donaldson