RE: SFTP Doubts

[email protected] ("Rajnikant")
Newsgroups perl.beginners
Message-ID <[email protected]>
Thanks Jenda.

I have one more question related to SFTP get method failure.
Following is the code I'm using to transfer the files across machines using
SFTP.
But somehow my Get method is failing though I can see the file downloaded
from remote 
machine on client.

#!/usr/bin/perl
use Net::SFTP;

my $host = 'xx.yy.zz.aa';
my %args = (
       "user",         'root',
       "password",     'pass123'
);
my $remoteFilename = '/var/opt/mydata/remote.txt';
my $localFilename = '/root/Test/local.txt';
my $sftp = Net::SFTP->new($host,%args);
 
print (" Got connected to host");
 
if(!($sftp->get($remoteFilename,$localFilename)) )
{
     my $err = $sftp->status();
     print (" Get failed ");
}
 
What might be the reason behind this method failure?

Thanks in advance.

~~~~~~~~~~~~~~~~~~~~
Thanks and Best regards,
~ Rajnikant
Software Engg.
Persistent Sys. Ltd.
Ph. +91 98222 04088

-----Original Message-----
From: Jenda Krynicky [mailto:[email protected]] 
Sent: Tuesday, May 27, 2008 6:36 PM
To: [email protected]
Subject: Re: SFTP Doubts

From:	"Rajnikant" <[email protected]>
> Hello everyone,
>  
> I'm trying to replace FTP module by SFTP. I'm facing some issues in 
> doing same.
> Following is the list of my doubts :(.
>  
> 1. why are there no ascii and binary methods associated with SFTP?

Most likely because the authors believed everyone should use some kind of
Unix anyway.

> 2. Are there any methods exists in SFTP similar to that of 
> login,ascii,binary as that in FTP module?

For login it depends a bit on the module used, I ended up using Net::SSH2,
cause I could not get Net::SFTP working under Windows. 
There you first create an SSH2 object, authenticate that and then ask it for
a SFTP object.

There is no ascii/binary in SFTP as far as I know.

> 3. How to check SFTP method failure in Perl?

Depends on the module.

> 4. how to delete the SFTP object created by New method?

undef($obj); ?

Jenda
===== [email protected] === http://Jenda.Krynicky.cz ===== When it comes to
wine, women and song, wizards are allowed to get drunk and croon as much as
they like.
	-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/



DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.