
Problems with sourcing a file
: Keywords:
: Hi Readers,
: I am posting this for a friend of mine(and I am myself curious).
: The SOURCE command doesn't seem to work in Perl i.e
: --------------------------
: #!/usr/bin/perl
: system("source .cshrc")
: --------------------------
"source" is a csh keyword. I imagine that system invokes /bin/sh which does not
support "source". I suppect you will need to do something like this piece of
untested, off-the-top-of-my-head code
system("/bin/csh")
which should then automatically source the ~/.cshrc.
Note, that since system invokes a child shell, which in turn invokes csh, it is the
csh shell that gets the new environment settings. These environment variables will
not be inherited back to the invocation program (ie. perl).
Andrew