Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Net::OpenSSH pass options to ssh

by kcott (Archbishop)
on Mar 22, 2019 at 08:51 UTC ( [id://1231567]=note: print w/replies, xml ) Need Help??


in reply to Net::OpenSSH pass options to ssh

G'day zn553,

Welcome to the Monastery.

As I can see no other mention of it, I thought I'd point out that your first statement has:

... key_path= $private_key_path, ...

Here's how Perl sees that statement:

$ perl -MO=Deparse,-p -e 'my $ssh = Net::OpenSSH->new($host, user => $ +user, master_opts => ["-vvv"], key_path= $private_key_path, default_s +sh_opts=>[-o =>"Port=24"]);' Can't modify constant item in scalar assignment at -e line 1, near "$p +rivate_key_path," -e had compilation errors. (my $ssh = 'Net::OpenSSH'->new($host, 'user', $user, 'master_opts', [' +-vvv'], ('key_path' = $private_key_path), 'default_ssh_opts', [(-'o') +, 'Port=24']));

Changing '=' to '=>':

$ perl -MO=Deparse,-p -e 'my $ssh = Net::OpenSSH->new($host, user => $ +user, master_opts => ["-vvv"], key_path=> $private_key_path, default_ +ssh_opts=>[-o =>"Port=24"]);' (my $ssh = 'Net::OpenSSH'->new($host, 'user', $user, 'master_opts', [' +-vvv'], 'key_path', $private_key_path, 'default_ssh_opts', ['-o', 'Po +rt=24'])); -e syntax OK

This comment is not intended to invalidate other responses. However, as you've shown no surrounding code — which could perhaps capture the error in an eval, or similar, block — nor any error or warning output, this may be an additional problem you'll need to address.

If you're unfamiliar with the code I've used, take a look at B::Deparse; and, in case you need it, perlrun has more information on Command Switches.

— Ken

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-25 06:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found