syphilis has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I'm on win32, perl-5.12, and I'm using the Net::SSH2 backend with Net::SFTP::Foreign.

No problems with:
use Net::SFTP::Foreign; $ftp = Net::SFTP::Foreign->new( host => $server, backend => 'Net_SSH2', user => $user, password => $pass, #more => ['-v'] );
But as soon as I include the 'more' option, the construction fails with:
Invalid option 'more' or bad combination of options at myfile.pl line +367
Does anyone know why this happens ? (That 'more' option is supposed to provide verbosity.)
I've also tried more => '-v', ... which shouldn't make any difference ... and doesn't :-)

Cheers,
Rob

Replies are listed 'Best First'.
Re: Net::SFTP::Foreign new constructor won't accept "more=>['-v']"
by Khen1950fx (Canon) on Dec 26, 2010 at 09:21 UTC
    I'm on Fedora, and it won't work for me. I did a workaround by using $ssh2->debug(1):
    #!/usr/bin/perl use strict; use warnings; use Net::SSH2; use Net::SFTP::Foreign; use Net::SFTP::Foreign::Backend::Net_SSH2; my $host = 'localhost'; my $user = 'user'; my $pass = 'password'; my $ssh2 = Net::SSH2->new(); $ssh2->debug(1); $ssh2->connect($host) or die "Connect failed!\n"; $ssh2->auth_password($user, $pass) or die "password auth failed\n"; my $sftp = Net::SFTP::Foreign->new(ssh2 => $ssh2, backend => 'Net_SSH2'); $sftp->error and die "Unable to establish a SFTP connection: ", $sftp->error; $sftp->get('/root/foo.txt', '/root/foo2.txt');
      I did a workaround by using $ssh2->debug(1)

      Yes, that workaround provides debug info for me, too. Thanks for that!!
      It's also reassuring to know that Windows is not the only OS being affected.

      I'll submit a big report about the unusability of "more => '-v'" in a day or two. (I'll just hang back for a bit in case there's some other relevant material comes to light wrt this.)
Re: Net::SFTP::Foreign new constructor won't accept "more=>['-v']"
by oko1 (Deacon) on Dec 26, 2010 at 20:44 UTC

    "more => ['-v']" works just fine if you omit the "backend => 'Net_SSH2'" option. Net::SFTP::Foreign uses 'ssh' by default (i.e., when no alternate backend is specified) - and 'ssh' has no problem accepting a '-v' option, so all is well. Net_SSH2, however, is not an external program; according to its docs, it's a Perl interface to libssh2. So, commandline arguments such as '-v' aren't applicable.

    (Caveat Lector: I'm not an expert on either module, and am not speaking as one; I just happened to have both of them on my system, ran a bit of code against them, and reviewed the applicable docs.)


    -- 
    Education is not the filling of a pail, but the lighting of a fire.
     -- W. B. Yeats
    
Re: Net::SFTP::Foreign new constructor won't accept "more=>['-v']"
by Mr. Muskrat (Canon) on Dec 26, 2010 at 20:48 UTC

    I use Net::SFTP::Foreign at work with more => ['-v'] without any problems. I'm not using the Net::SSH2 backend though so maybe that's related; the Net::SFTP::Foreign docs say "Custom backends may change the set of options supported by the new method."

      the Net::SFTP::Foreign docs say "Custom backends may change the set of options supported by the new method."

      I didn't notice that. No need for a bug report then.
      Thanks Mr.Muskrat, oko1.

      Cheers,
      Rob