I have a lot to learn when it comes to the syntax of hashes, and needed to be re-reminded of the abbreviation and the arrow rule. We've traversed a fairly wide arc in this thread from beginning with redacting to implementing Config::Tiny. I didn't get very far on the archiving itself and work on that presently. I do think that better usenet and perlmonks threads end when OP posts code that works. I ended up creating a new script that a) holds example values for the user to change when they customize their settings, and b) creates the .ini file that will populate values for dialing up a server. I'll post STDOUT, the .ini file, and then the script itself
$ ./1.initialize.pl $VAR1 = bless( { 'my_github' => { 'email' => 'aldebaran66@gmail.com', 'password' => 'ahDF8w2se' }, 'my_sftp' => { 'base_url' => 'http://www.merrilljohns +on.com', 'port' => '22', 'password' => 'gdtRJpN78w', 'domain' => 'home357357.1and1-data.hos +t', 'username' => 'u3738494' } }, 'Config::Tiny' ); created /home/bob/Documents/4.example.ini ----------- $ cat /home/bob/Documents/4.example.ini [my_github] email=aldebaran66@gmail.com password=ahDF8w2se [my_sftp] base_url=http://www.merrilljohnson.com domain=home357357.1and1-data.host password=gdtRJpN78w port=22 username=u3738494 $ ---------- $ cat 1.initialize.pl #!/usr/bin/perl -w ###### ## User: start here. ## The values you will need to populate to create a proper ini file ar +e here. ## Change the ones you need to. You shouldn't have to change any of th +e ## lexical perl. The most these example data will be is irrelevant. ###### use 5.011; use Data::Dumper; use Path::Tiny; use Config::Tiny; use constant { ENCODING => 'utf8' }; my %config = ( my_sftp => { domain => 'home357357.1and1-data.host', username => 'u3738494', password => 'gdtRJpN78w', port => '22', base_url => 'http://www.merrilljohnson.com', }, my_github => { email => 'aldebaran66@gmail.com', password => 'ahDF8w2se', }, ); 1; my $ini_file = "4.example.ini"; my $ref_config = \%config; my $ini_path = path( "/home/bob/Documents", $ini_file ); my $ini = bless $ref_config, 'Config::Tiny'; say Dumper $ref_config; # this will clobber any previous file of same name $ini->write( $ini_path, ENCODING ); say 'created ', $ini_path; __END__ $
Of course, none of what works in the above code would have happened without the excellent comments and provision of source that this forum provided. Thank you.
In reply to Re^6: redacting from config hash
by Aldebaran
in thread redacting from config hash
by Aldebaran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |