|Problems? Is your data what you think it is?
Re^4: different exe path for different OSby bergbrains (Acolyte)
|on Aug 31, 2010 at 20:59 UTC
You're correct, Salva. If you exec before you exit the BEGIN block, you're safe from the problems I noted regarding missing modules.
...does not throw the "Can't locate..." exception, whereas if you get beyond the BEGIN block, the use line will barf.
So, we now have two viable options:
I looked at using $^O to get the key to identify the right Perl for the platform, but I've got two Linux installs -- one for 32-bit and one for 64-bit, and $^O only shows 'Linux'. I took a quick look at this: http://search.cpan.org/perldoc?perlport#PLATFORMS. There's probably something available in the Config module that would provide the granularity I'm looking for.
I want to make sure that I'm able to derive the path to my executables from both Perl and shell scripts -- I'm now using `uname -p`.
Thank you both for these solutions. Currently, our processes run in multiple environments (mainly DEV, STAGE and PROD), and we source a profile for each to pick up a number of variables that dictate various behaviors including directories and to which db we connect. I think we're going to go with Mortiz's env-on-the-bang-line solution, because it fits in better with our existing process.