Since we've finally been able to get a development machine, I find
myself needing a quick, efficient way of pointing the programs we write
at the correct location for the different servers they need to talk to.
For instance, in production we use server A for the database server.
But in development, we want to use server B since it's not a live
database.
I came up with a simple way to do this in each program by creating a
little configuration file that looks like this :
DBSERVER=servera.mydomain.com
AUTHSERVER=serverq.mydomain.com
And then using the following code to read these values into the program
:
open(CONF, "</etc/myprog.conf");
while (<CONF>) {
chomp;
my ($hashname,$hashvalue) = split(/=/,$_,2);
$self->{$hashname} = $hashvalue;
}
close(CONF);
This works great as is. However, I wonder if there is a quick and easy
way to do this on a global scale. I'd like to be able to have a
"global" config file with all of the common parameters in it and then be
able to use a module to give me only the values I need.
I'd like to avoid keeping junk in memory, so it would either have to
only read in what I need, or give me what I need so I can store it in
local variables and then purge it's memory. (I'm a minimalist I guess
:-))
Any idea on how to do this? Thoughts? Suggestions? Code!?
---------------------------
Jason H. Frisvold
Senior ATM Engineer
Engineering Dept.
Penteledata
RHCE - 807302349405893
CCNA - CSCO10151622
[EMAIL PROTECTED]
---------------------------
"So Long and Thanks for all the Fish" -- Douglas Adams [1952-2001]