Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Problem with "put" in Net::SFTP::Foreign::Compat

by emerlyn (Initiate)
on Apr 29, 2013 at 11:08 UTC ( #1031195=perlquestion: print w/ replies, xml ) Need Help??
emerlyn has asked for the wisdom of the Perl Monks concerning the following question:

I've been trying to transfer 3 files from a local host to a remote host. I am able to successfully connect to the remote host. However, when I try to use "put", I encounter an error.
Here's a snippet of my code.

my %args = ( user => "uname", password => "pword" ); my $sftp = Net::SFTP::Foreign::Compat->new($rhost, %args); $sftp->die_on_error("Unable to establish connection"); for(@files) { my $filename = basename($_); my $remotefile = $rdir . $filename; $sftp->put($_, $remotefile); }

I get this error

Use of uninitialized value in numeric ne (!=) at /usr/opt/Perl5_10/lib +/perl5/site_perl/5.10.1/Net/SFTP/Foreign/Common.pm line 79. Use of uninitialized value in numeric ne (!=) at /usr/opt/Perl5_10/lib +/perl5/site_perl/5.10.1/Net/SFTP/Foreign/Common.pm line 79. Use of uninitialized value in numeric ne (!=) at /usr/opt/Perl5_10/lib +/perl5/site_perl/5.10.1/Net/SFTP/Foreign/Common.pm line 79. Use of uninitialized value in numeric ne (!=) at /usr/opt/Perl5_10/lib +/perl5/site_perl/5.10.1/Net/SFTP/Foreign/Common.pm line 79. Use of uninitialized value in numeric ne (!=) at /usr/opt/Perl5_10/lib +/perl5/site_perl/5.10.1/Net/SFTP/Foreign/Common.pm line 79. Use of uninitialized value in numeric ne (!=) at /usr/opt/Perl5_10/lib +/perl5/site_perl/5.10.1/Net/SFTP/Foreign/Common.pm line 79.

This is what's in Common.pm line 79-81

if ($sftp->{_error} != Net::SFTP::Foreign::Constants::SFTP_ERR_CONNECT +ION_BROKEN()) { $sftp->{_error} = 0; }

Comment on Problem with "put" in Net::SFTP::Foreign::Compat
Select or Download Code
Re: Problem with "put" in Net::SFTP::Foreign::Compat
by Anonymous Monk on Apr 29, 2013 at 11:37 UTC

    I get this error

    that is a warning, the kind of error that doesn't end your program -- is it important? Probably not

    This is what's in Common.pm line 79-81

    It doesn't matter. It appears you turned on warnings globally and you shouldn't do that. don't turn on warnings for code you did not write esp if the code does  no warnings 'uninitialized';

Re: Problem with "put" in Net::SFTP::Foreign::Compat
by salva (Abbot) on Apr 29, 2013 at 11:51 UTC
    This is a harmless warning you can safely ignore. It is caused by a (harmless) bug on the module that I have just fixed in version 1.76_02.

    In any case, die_on_error is not on Net::SFTP API. If you are using Net::SFTP::Foreign::Compat you should stick to that. Though, If you are writing your module from scratch, just use the much friendly Net::SFTP::Foreign module.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1031195]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2015-07-03 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (55 votes), past polls