in reply to Re^3: replicating the command 'unset LIBPATH' in perl
in thread replicating the command 'unset LIBPATH' in perl

Again thanks. I have put it in a BEGIN statement - and again, whilst it does appear to unset the libpath, it doesn't enable me to connect to the database. The *only* command that seems to work is running unset LIBPATH prior to running the script.

It would seem the super user account has the db2profile as default environment.

It runs both applications which require db2inst1 profile (db2 v8) and db2inst2 profile (db2 v9).

The thought is now to consider setting db2profile env before app start and not having db2profile in the super user profile - although the person charged with doing that seems overly reticent (without giving his reasons) to do it.

Cheers for your help

  • Comment on Re^4: replicating the command 'unset LIBPATH' in perl

Replies are listed 'Best First'.
Re^5: replicating the command 'unset LIBPATH' in perl
by Anonymous Monk on May 18, 2010 at 07:00 UTC
    This should work
    #!/usr/bin/perl -- BEGIN { unless( $ENV{ +__FILE__ } eq __FILE__ ){ delete $ENV{LIBPATH}; $ENV{ +__FILE__ } = __FILE__; exec $^X, __FILE__, @ARGV; # relaunch without LIBPATH } } ...
      That can be simplified to:
      BEGIN { if (exists $ENV{LIBPATH}) { delete $ENV{LIBPATH}; exec $^X, __FILE__, @ARGV; } }
        Thanks gents - I now feel like the beginner I am!

        But....what is __FILE__?