in reply to How about a module for "passwords"?

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.

Replies are listed 'Best First'.
Re: Re: How about a module for "passwords"?
by John M. Dlugosz (Monsignor) on Jan 27, 2003 at 06:19 UTC
    It sounds like your package Attr should be exporting the struct. Then the script can use Attr qw/%struct/; instead of the two additional lines you have there.

    I see the point of the system, though. Multiple scripts can use the same configuration data, and that data can be protected and treated differently than the scripts.

    —John

      yeah, good call, there was some reason i didnt do it in the 1st place, probably laziness.. ;-)