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


In reply to Re: Net::OpenSSH pass options to ssh by kcott
in thread Net::OpenSSH pass options to ssh by zn553

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.