I have a strange scenario (ooh missus)... When logged on as a super user, the only way I can connect to a database is by issuing the unset LIBPATH command before running my script. I have tried numerous ways to replicate this command within my script such as
1/ $command = 'unset LIBPATH'; system( $command );
but get the error Can't exec "unset": A file or directory in the path name does not exist.
$ENV{LIBPATH} = ""
and
$ENV{LIBPATH} = '/usr/lib:/lib:/home/db2inst1/sqllib/lib'
and
delete $ENV{LIBPATH};
and
system("LIBPATH=/usr/lib:/lib:/home/db2inst1/sqllib/lib; export LIBPAT +H");
and
$ENV{LIBPATH} = $ENV{ LIBPATH } . ":/lib:/home/db2inst1/sqllib/lib";
Whilst these appear to have set the $ENV{LIBPATH} correctly, I still get the error message
DBI connect('OLTTST','joltdev',...) failed: Total Environment allocati +on failure! Did you set up your DB2 client environment? at /apps/bin +/modules/jolt.pm line 88 DBI::__ANON__[/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-mu +lti/DBI.pm:658]('undef','undef') called at /usr/opt/perl5/lib/site_pe +rl/5.8.2/aix-thread-multi/DBI.pm line 660 DBI::connect('DBI','dbi:DB2:OLTTST','joltdev','joltuser') call +ed at /apps/bin/modules/jolt.pm line 88 jolt::connect() called at /apps/bin/optus/reconcile_withdotsh. +pl line 122 jolt::connect(/apps/bin/modules/jolt.pm:91):
The ONLY thing that seems to allow me to connect is running the 'unset LIBPATH' command before I run my script. Now I appreciate that I'm not supplying a whole heap of code here, but I just wonder if anyone has encountered a similar problem wherein they can connect as themselves, but not as a super user unless they have reset the libbath?

To be honest having tried whatever I can think of I haven't a clue!

I'd be grateful if anyone could suggest even the most outlandish resolution. Thanks Kev


In reply to replicating the command 'unset LIBPATH' in perl by viffer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.