Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

NET::SFTP::Foreign in perl

by vetrivel (Sexton)
on Jun 13, 2009 at 08:19 UTC ( #771192=perlquestion: print w/replies, xml ) Need Help??
vetrivel has asked for the wisdom of the Perl Monks concerning the following question:

My code is
use Net::SFTP::Foreign; $host = "" ; %args = ( "user" => "vetri" , "password" => "vetri" , "more" => '-v' ) ; my $sftp = Net::SFTP::Foreign->new( $host,%args )

In the above code I used args hash . In this hash I used password key , If I remove the password key , It asks the password in the command line and works fine . But when I put password key in the hash , It does not work . I got "Password not requested as expected error"

Please help me to resolve this issue

Replies are listed 'Best First'.
Re: NET::SFTP::Foreign in perl
by Khen1950fx (Canon) on Jun 13, 2009 at 23:07 UTC
    I cleaned it up a little, then I tried this:

    #!/usr/bin/perl use strict; use warnings; use Net::SFTP::Foreign; my $sftp = Net::SFTP::Foreign->new( 'user@localhost', password => 'password', more => ['-v'] ); $sftp->get('/remote/Desktop/copy', '/home/user/Desktop/copy') or die "unable to retrieve copy: ".$sftp->error;

    This worked for me.

Re: NET::SFTP::Foreign in perl
by Anonymous Monk on Jun 13, 2009 at 08:40 UTC
      my $sftp = Net::SFTP::Foreign->new('vetri@hostname' ,password => '**** +*' ,expect_log_user => 1,time out => 8,more => '-v' ) ;

      the below code is not working . I got same error . The used Net-SFTP-Foreign-1.51 version . The server is running

        Hi, I am the author of Net::SFTP::Foreign, your problem seems to be caused by a bug there so could you post (or if you prefer, sent me be email) the working and the non-working scripts?

        Also, set $Net::SFTP::Foreign = -1; at the beginning, rerun them and include the generated debugging information, please.

Re: NET::SFTP::Foreign in perl
by salva (Abbot) on Jun 26, 2009 at 11:12 UTC
      Dear salva,
      I too get this error - Password not requested as expected: -1

      I am using Perl 5.8.9 and have installed Net-SFTP-Foreign-1.53, Expect-1.21 and IO-Tty-1.07. When I try to pass the password in the code itself, I get this error.

      my $sftp = Net::SFTP::Foreign->new(abc@', password => 'password', timeout => 300);

      I opened the file and found a method ipc_open2_bug_workaround(). Looks like this subroutine was meant for fixing the bug explained. Any idea why I still get the error.

      Thanks in advance
        There was a regression on Net::SFTP::Foreign 1.53.

        The problem is solved in the new version 1.54_01 that I have just uploaded to CPAN.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://771192]
Approved by lakshmananindia
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2018-04-24 02:18 GMT
Find Nodes?
    Voting Booth?