Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^2: Sourcing shell scripts

by tuxz0r (Pilgrim)
on Oct 20, 2007 at 05:55 UTC ( #646140=note: print w/replies, xml ) Need Help??

in reply to Re: Sourcing shell scripts
in thread Sourcing shell scripts

I can always set an environment variable using the built in %ENV on Unix (or you mention 'use Env' on Windows) but the idea was to make use of our existing shell environment (which is built dynamically when our software package is installed) so we can have a single source of environment settings (easier to debug, modify, etc.). We needed these shell environments set outside of the Perl script and we didn't want to duplicate them by having another Perl script to set the environment just for Perl.

The code snippet posted will source this shell environment file prior to exec'ing the Perl script, that way it's available to the Perl code. We don't run these programs by hand, they run from a cron job, and we previously had to write a shell wrapper to perform the same function that the snippet does automatically for us. Plus, now any of our shell debugging tools and utilities are using the exact same environment settings as the actual Perl scripts that run the system. Which was the whole point.

I hope this makes sense.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://646140]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2023-02-04 08:32 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (31 votes). Check out past polls.