Sourcing a .cshrc-like file from within a perl script
Posted on 2000-04-14
On an Irix platform, I have the following files:
*a file that contains environmental variables
*an executable file main.exe
If I try to do something like:
2 system ("source sourcefile");
3 system ("main.exe");
then main.exe ends up dying because the environmental variables don't stick after line 2.
I've also tried:
2 eval ("source sourcefile");
3 eval ("main.exe");
with no success.
My current workaround is:
2 system ("doeverything");
where "doeverything" is a separate C-shell script that sources sourcefile correctly and properly runs main.exe.
Is there a better way to do this, without using the C-shell? Or am I stuck using this method?
Constraint: sourcefile and main.exe cannot be massaged into perl.
Thanks in advance.