reluctant_techie has asked for the wisdom of the Perl Monks concerning the following question:
Hello!
I am attempting to set a shell (bash) environment variable from within a Perl script but I have not been able to come up with a satisfactory solution. In particular, I am attempting to set the CVSROOT environment variable so that I can use the "system()" syntax to execute cvs commands. I had hoped the following syntax would work:
It does not.system "export CVSROOT=<cvs>"
Another solution would be to create a shell script on the fly which would contain a command to set the environment variable. My Perl script would then execute the shell script. This seems pretty messy.
Is there a better solution?
Thanks in advance!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Set shell environment variables from within a perl script
by Corion (Patriarch) on May 05, 2008 at 17:01 UTC | |
by moritz (Cardinal) on May 05, 2008 at 17:07 UTC | |
Re: Set shell environment variables from within a perl script
by Joost (Canon) on May 05, 2008 at 17:03 UTC | |
by johngg (Canon) on May 05, 2008 at 17:26 UTC | |
by Joost (Canon) on May 05, 2008 at 18:15 UTC | |
Re: Set shell environment variables from within a perl script
by rovf (Priest) on May 05, 2008 at 17:06 UTC |
Back to
Seekers of Perl Wisdom