jujiro_eb has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I am using ActiveState perl on Windows Vista. A previous Oracle 10g installation had also installed some custom version of Perl. The only presence of that installation is know by the PERL5LIB variable, which points to various folders within Oracle installation.

I created my application module. which has a dependencies with a few CPAN modules. I put all those dependent modules in my <my application folder>/lib folder.

To avoid breaking anything in Oracle and not to step on each others' toes, I run my application using the following syntax:.

c:\perl\bin\perl -I"<my application folder>/lib" "<my application folder>/script/myscript.pl"

This works fine only if I destroy the PERL5LIB variable. With PERL5LIB variable in place, I start getting errors about missing modules, even though I am not using them.

Can you please suggest a graceful method to overcome this issue (meaning keeping Oracle environment in tact and running my app without any effects from Oracle side).

Thank you so much in advance.

Ash

Replies are listed 'Best First'.
Re: Perl5lib causes conflict?
by moritz (Cardinal) on Nov 09, 2009 at 14:16 UTC
    You can put
    BEGIN { delete $ENV{PERL5LIB} } use lib "<my application folder>/lib";
    in your script before loading any modules, or write a wrapper that unsets PERL5LIB before starting your perlscript and use that instead of executing the perl script directly.
    Perl 6 - links to (nearly) everything that is Perl 6.
      Hello Moritz,

      Thanks for the reply. I am in fact using your second method of unsetting PERL5LIB variable through a batch file. Your first suggestion will not work for me because I do not know where my users may install the application ("<my application folder>"). I cannot rely on current folder because the launching of the script can be done from any folder.

      Regards.

      Ash
        If the lib folder has a constant relation to the binary, you can use FindBin (core module) to find he path to the binary, and thus to the lib dir too.
        Perl 6 - links to (nearly) everything that is Perl 6.