in reply to Testing a library that accesses an Oracle Database

At least with some environment variables and some operating systems, the variables are only used by the OS at process start time. This means that setting the environment variables after the start of your process does not help the current instance of your process. One approach to circumvent is to set up the environment within the first instance of your process and then to relaunch the process via exec. See for some examples:

  • Comment on Re: Testing a library that accesses an Oracle Database

Replies are listed 'Best First'.
Re^2: Testing a library that accesses an Oracle Database
by docdurdee (Scribe) on Sep 23, 2016 at 18:16 UTC
    Thanks Corion!! I was able to get it to work following your previous posts on the topic. Adding this to head of the test:
    BEGIN { if( ! $ENV{PDUPRE_RESTART}) { $ENV{LD_LIBRARY_PATH} = '...some Oracle path../lib'; #$ENV{DYLD_LIBRARY_PATH} = '...some Oracle path../lib'; #Either + LD OR DYLD works $ENV{PDUPRE_RESTART} = 1; exec $0, '--restarted', @ARGV }; };
    worked after I made the test an executable and set the shebang line to point to my local install of perl:
    !#/Users/.ME./perl
    I had it set to:
    !#/usr/bin/env perl
    but it didn't show up because I am in the habit of running my perl scripts/tests using `perl t/some.t`; if I run using `/usr/bin/env perl t/some.t` than I again get the error from the OP.