$CONFIG = { my_github => { #### our %config = ( my_sftp => { #### $ cat config3.tmpl package config3; use Exporter qw(import); our @EXPORT = qw(%config); {$config_hash} 1; ---------- $ cat util2.pm package utils2; require Exporter; use utils1; our @ISA = qw(Exporter); our @EXPORT = qw( redact make_ini); sub redact{ use strict; use warnings; use 5.010; use Path::Tiny; my $file = shift; #use $file; resulted in error use config2; my $sub_hash = "my_github"; my $email = $config{$sub_hash}->{'email'}; my $password = $config{$sub_hash}->{'password'}; my $tempdir = Path::Tiny->tempdir('backup_XXXXXX'); say "temp dir is $tempdir"; my $scratch_file = $tempdir->child('batch_01', '1.manifest.txt')->touchpath; say "scratch_file is $scratch_file"; my $parent = $scratch_file->parent; say "parent is $parent"; chdir $tempdir unless $tempdir->subsumes(Path::Tiny->cwd); system("pwd"); use Data::Dumper; print Dumper \%config; my $b = "dummy"; return $b; } sub make_ini{ use strict; use warnings; use 5.010; use Path::Tiny; my $file = shift; use config2; use Config::Tiny; use Data::Dumper; my $path = shift; say "path is $path"; say "is the stuff here?"; print Dumper \%config; $config->write( $path, 'utf8' ); #this line draws error chdir "/home/bob/Documents"; system("cat *.ini"); my $b = "dummy"; return $b; } 1; #### All tests successful. Files=5, Tests=49, 3 wallclock secs ( 0.06 usr 0.01 sys + 0.45 cusr 0.10 csys = 0.62 CPU) Result: PASS RSAVAGE/Config-Tiny-2.23.tgz /usr/bin/make test -- OK Running make install Manifying 1 pod document Installing /usr/local/share/perl/5.26.1/Config/Tiny.pm Installing /usr/local/man/man3/Config::Tiny.3pm Appending installation info to /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/perllocal.pod RSAVAGE/Config-Tiny-2.23.tgz /usr/bin/make install -- OK cpan[2]> q Terminal does not support GetHistory. Lockfile removed. $ man Config::Tiny $ ./1.redact.pl Variable "$config" is not imported at template_stuff/utils2.pm line 61. Global symbol "$config" requires explicit package name (did you forget to declare "my $config"?) at template_stuff/utils2.pm line 61. Compilation failed in require at ./1.redact.pl line 6. BEGIN failed--compilation aborted at ./1.redact.pl line 6. #### $ cat config2.pm package config2; use Exporter qw(import); our @EXPORT = qw(%config); our %config = ( my_sftp => { domain => '', username => '', password => '', }, my_github => { email => '', password => '', }, ); 1; $