Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: How about a module for "passwords"?

by Ryszard (Priest)
on Jan 25, 2003 at 17:29 UTC ( [id://229869]=note: print w/replies, xml ) Need Help??


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.. ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://229869]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-18 18:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found