in reply to Re^3: redacting from config hash
in thread redacting from config hash
It seems to me that a user would want a one session experience to populate his/her critical data. Thus, I've been removing hard-coded values one by one. What remains is a hard-coded path to an ini file, which I think is on the verge of working, but vexingly, does not. This is an analog to what I've used before to instantiate the sftp object. Perl thinks this is illegal:
sub get_tiny{ use 5.011; use warnings; use Net::SFTP::Foreign; use Config::Tiny; use Data::Dumper; my $ini_path = qw( /home/bob/Documents/html_template_data/3.values.ini + ); say "ini path is $ini_path"; my $sub_hash = "my_sftp"; my $Config = Config::Tiny->new; $Config = Config::Tiny->read( $ini_path , 'utf8' ); say Dumper \%Config; my $domain = $Config{$sub_hash}->{'domain'}; my $username = $Config{$sub_hash}->{'username'}; my $password = $Config{$sub_hash}->{'password'}; my $port = $Config{$sub_hash}->{'port'}; #dial up the server say "values are $domain $username $password $port"; my $sftp = Net::SFTP::Foreign->new( $domain, user => $username, port => $port, password => $password) or die "Can't connect: $!\n"; return $sftp; }
List of compiler complaints:
$ ./1.qy1.pl Global symbol "%Config" requires explicit package name (did you forget + to declare "my %Config"?) at template_stuff/html4.pm line 215. Global symbol "%Config" requires explicit package name (did you forget + to declare "my %Config"?) at template_stuff/html4.pm line 216. Global symbol "%Config" requires explicit package name (did you forget + to declare "my %Config"?) at template_stuff/html4.pm line 217. Global symbol "%Config" requires explicit package name (did you forget + to declare "my %Config"?) at template_stuff/html4.pm line 218. BEGIN not safe after errors--compilation aborted at template_stuff/htm +l4.pm line 239. Compilation failed in require at ./1.qy1.pl line 5. BEGIN failed--compilation aborted at ./1.qy1.pl line 5. $
I just don't see where I'm not correctly imitating the syntax shown on Config::Tiny.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: redacting from config hash
by hippo (Archbishop) on Aug 03, 2018 at 08:34 UTC | |
by Aldebaran (Curate) on Aug 06, 2018 at 21:39 UTC | |
|
Re^5: redacting from config hash
by haukex (Archbishop) on Aug 03, 2018 at 08:36 UTC | |
by Aldebaran (Curate) on Aug 06, 2018 at 21:28 UTC |