Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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.)


Comment on Re: Setting a library path (export) to call SSH
Download Code
Re^2: Setting a library path (export) to call SSH
by Preceptor (Chaplain) 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 (Prior) 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 }

    --MidLifeXis

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2014-10-23 11:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (125 votes), past polls