Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Setting a library path (export) to call SSH

by OfficeLinebacker (Chaplain)
on Jul 08, 2013 at 19:57 UTC ( #1043176=note: print w/replies, xml ) Need Help??

in reply to Setting a library path (export) to call SSH

I think what you have to do is set an environment variable from within perl, which you can do quite easily. There is a special hash variable called %ENV that you set like this:
$ENV{LIBPATH} = "/opt/freeware/lib:/opt/freeware/64/lib:/usr/lib:$ENV{ +LIBPATH}";
Best of luck!

(Note that using backticks to do something like `export LIBPATH=/opt/freeware/lib:/opt/freeware/64/lib:/usr/lib:$LIBPATH` launches a shell, sets the environment variable in that shell, then quits, which doesn't do you much good.)

Replies are listed 'Best First'.
Re^2: Setting a library path (export) to call SSH
by Preceptor (Deacon) on Jul 08, 2013 at 20:18 UTC

    You can, if you _really_ must encapsulate the setting environment into the 'backticks'.

    my $result = `set LIBPATH=/opt/freeware/lib:/opt/freeware/64/lib; ssh +$host stuff`;

    It's probably better to configure %ENV though. Any may be better yet to fix your library paths though - ssh is something that'd probably benefit from being 'properly installed' into the environment. Maybe even by replacing your ssh binary (in your path) with a wrapper script, in /usr/bin or similar. It may be worth doing a (non packaged) install of ssh, so you can install your own libs in the right places.

Re^2: Setting a library path (export) to call SSH
by MidLifeXis (Monsignor) on Jul 09, 2013 at 12:31 UTC

    Or to isolate the LIBPATH setting to just where needed...

    { local $ENV{LIBPATH} = "/opt/freeware/lib:/opt/freeware/64/lib:/usr/l +ib:$ENV{LIBPATH}"; # execute ssh command here }


      Thank you all for the wisdom and suggestions, much appreciated!!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043176]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2018-04-21 10:29 GMT
Find Nodes?
    Voting Booth?