in reply to How to hide a password in a script?
If I really had no other choice than to do this, I wouldn't embed the password in the main script.
I'd tuck it away in a module, probably one of the system module ( and include several that aren't required ), and export the password into the main namespace.
I'd probably tie the variable and only return the correct password after a particular value has been assigned to it.
And I'd only return the correct password once.
Thereafter, I would return the value passed.
In the script it would look like this:
#! perl use strict; use warnings; use diagnostics; use LWP; use This; use That; use The::Other; our $password = 'mysecret'; .... system( "command -p $password" ); ... ## If you print $password here, you get "mysecret"; ## But for the first time it was FETCH'd ONLY, ## it would be different.
Of course, now I've told you this, I'll have to kill you so that you can't tell anyone else.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to hide a password in a script?
by Aristotle (Chancellor) on Aug 06, 2004 at 22:27 UTC | |
by BrowserUk (Patriarch) on Aug 07, 2004 at 05:29 UTC | |
|
Re^2: How to hide a password in a script?
by beable (Friar) on Aug 06, 2004 at 22:40 UTC | |
by BrowserUk (Patriarch) on Aug 07, 2004 at 05:14 UTC | |
by Aristotle (Chancellor) on Aug 07, 2004 at 06:03 UTC | |
by BrowserUk (Patriarch) on Aug 07, 2004 at 06:27 UTC | |
by Aristotle (Chancellor) on Aug 07, 2004 at 06:43 UTC | |
by Aristotle (Chancellor) on Aug 06, 2004 at 22:48 UTC |