in reply to Re: using scp package and options
in thread using scp package and options

Thank you for your answer.

If you would mind helping me again please, I would appreciate your answers to some extra questions. But before, yes I did read the documentation under CPAN.org .

  1. It has to be "($server," instead of "(host => $server," ? I only want to be sure in this.
  2. Is it right, that the batchmode option is automatically set?
  3. Is it so that the protocol to set to 2 is not necessary?
  4. Doesnt $ssh have to closed like $ssh->quit or that way?

Thanks in advance, Have a nice day, Thomas

Replies are listed 'Best First'.
Re^3: using scp package and options
by salva (Canon) on Feb 12, 2015 at 08:34 UTC
    1: Both ways are valid:
    $s1 = Net::OpenSSH->new($host, ...); $s2 = Net::OpenSSH->new(host => $host, ...);

    2: No, by default Net::OpenSSH let's ssh ask you questions. If you want batch mode you have to state it:

    $s = Net::OpenSSH->new($host, batch_mode => 1, ...)

    3: Yes because Net::OpenSSH only works with version 2 of the protocol. SSH v1 is not supported.

    4: The connection is closed automatically when the object goes out of scope. You can close it explicitly if you want:

    $s->disconnect;

    update: disconnect method is only available in the latest development versions.

    Also, if you need to connect using SSH v1, my other module Net::SSH::Any does support it.