#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    7
    Rep Power
    0

    Need help on how to set the LD_LIBRARY_PATH with perl programming


    I was writing a perl script to set the LD_LIBRARY_PATH to null, but it is not working at all. Please put in suggestions/thoughts on this.

    use Env qw(LD_LIBRARY_PATH);
    BEGIN
    {
    $LD_LIBRARY_PATH = " ";
    }
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,932
    Rep Power
    1225
    We need more info to know the context of what you're doing/needing, but if you're needing to change an env var used in your script, then you should work with the %ENV hash.

    Code:
    $ENV{LD_LIBRARY_PATH} = '';
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    7
    Rep Power
    0
    Thanks FishMonger for helping on this.

    I was just trying to set the LD_LIBRARY_PATH to null like what you have mentioned like $ENV{LD_LIBRARY_PATH} = ' '; through the perl script. it is happening with the command line execution but through Perl script it is not successful.

    is it possible to do that?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,932
    Rep Power
    1225
    Perl scripts can't change the environment of their parent process. They can change their own env which propagates to their children.

    If you provide more details on the problem that you're attempting to resolve, we might be able to show you a better method.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    7
    Rep Power
    0
    consider we have opened terminal session, on that LD_LIBRARY_PATH which has been set already to some path like below

    LD_LIBRARY_PATH=.:/Users/nagarjun

    according to our requirement we need to set LD_LIBRARY_PATH to null and start the server.

    I tried this through the script but not able to make it success.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,932
    Rep Power
    1225
    That's not enough info.

    consider we have opened terminal session
    On the same server where the Perl script is running, or a remote system?

    start the server
    Does that mean reboot the server or start a daemon process?

    Does the Perl script start the server, or does it just make the env changes and exits?

    Please post your Perl script.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    7
    Rep Power
    0
    i think you got me wrong!!! since i m working in software licensing domain, server implies to our own licensing server.

    lets make it simple. As you said earlier we cant make an attempt to reset environmental variables through script.

    Here is the sample code which i was trying from long time.
    (i know this is not a way)

    use ENV qw(LD_LIBRARY_PATH);
    BEGIN
    {
    $LD_LIBRARY_PATH = " ";
    }

    please let me know if you have any workaround.

    i do have a workaround like this
    create a bash profile and set that profile through the script. i dont know whether it works or not.
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,932
    Rep Power
    1225

IMN logo majestic logo threadwatch logo seochat tools logo