I've got a perl script which needs to be aware of bash environment variables. I can use Env, but the problem is not all of the variables exist for the user that the script will be running as.
In bash, we accomplish this by having a shell script called env.sh which does a whole bunch of 'export VARIABLE=VALUE' calls.
Our shell scripts, then, do:
db2 "connect to $db user $user using $blah"
What I need to do is that same thing, only in perl. `source /path/to/env.sh` gives me a "no such command as source" error message, and `. /path/to/env.sh` followed by "my $dbname = $VARIABLE" (where $VARIABLE is one of those exported in env.sh) doesn't error, but doesn't seem to do anything either.
I still get
Global symbol "$VARIABLE" requires explicit package name at ./testing.pl line 33.
Execution of ./testing.pl aborted due to compilation errors.
Does anyone know how to work around this? I'm really not supposed to simply parse the env file, since its format has been known to change at will.