Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Sourcing shell scripts

by tuxz0r (Pilgrim)
on Oct 20, 2007 at 05:55 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-19 08:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found