> Specifically I would like to set environment variables inside a perlIf you want to set environmental variables from within Perl, %ENV is> script which are stored inside a separate config file (used by many
> other programs)
the place to set such items. perldoc perlvar for more information.
No offense, but what's the issue with this? It seems like it does>
> At the moment I have a separate ksh script wrapper around my perl
> script which simply does something like
> . /dir/config.sh
what you wnat it to do. If you want ALL scripts to have the SAME
environmental variables, why not set them from within .profile or
..bashrc or.cshrc or some variation of the three based upon your shell?
Because it's not portable. Perl is designed with portablity in mind.>
> but there's got to be a better way than that.
> Unfortunately neither "." nor "source" are particularly easy things
> to search for and I've not spotted anything in either perldoc nor
> googling this newsgroup.
WIN32 systems don't use '.' or 'source' without some help (ie
Cygwin). Might I suggest you read some more of the Perl
doentation. Perl is not your average scripting language (like
C-Shell, BASH, KSH, etc).
This is a workable solution if you can't keep the environmental>
> I guess I could have the perl script read the config file explicitly
> and act upon what it finds there - but someone must have tackled
> this already.
variables set in the parent shell. It's also more portable. If you
decide, one day, to run the scripts on a WIN32 machine, then you don't
have to re-invent the wheel to do so. There are several modules to
aid in this task -or- you could roll your own.