Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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

by viffer (Beadle)
on May 18, 2010 at 06:35 UTC ( #840453=note: print w/replies, xml ) Need Help??

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__?

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2022-05-29 08:28 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (101 votes). Check out past polls.