Where i work we have an environemnt in which many different scripts must have access to different hosts, databases etc etc. We use this method:
package Attr;
use strict;
use vars qw(%struct);
%struct =
(
infomgr => {
sid => 'xxxxxx',
username => 'xxxxxx',
passwd => 'xxxxxx',
},
)
This way we can have multiple hosts, databases (in fact any arbitrary data.)
To reference the data in our scripts:
use Attr (); # Application wide configuration
use vars qw(%struct); # Grab the datastructure from the config fil
+e
*struct = \%Attr::struct; # Alias the variable out
..
..
print $self->{config}{infomgr}{sid} # for want of a better example
We also have the OS accounts locked down tightly as well as permissions on the file. This works quite well for us as we've got a single point for all our configuration data.