------------------------------------------------
On Tue, 7 Oct 2003 16:09:44 -0400 , Roberts Mr Richard L <[EMAIL PROTECTED]> wrote:

> <Please start a new thread when appropriate.>Sorry, new to discussion group
> yet thanks for the advice.

Also remember to group reply so others can help and be helped.

> 
> <My first question is, are you trying to copy a file from the local system
> to the remote?> is what I am attempting. Using Net::SSH::Perl I can logon to
> remote host, create $directory, yet when I try to copy a local file to
> remote host it bails. I ran: perl -e 'use Net::SFTP;' and errors so module
> is not installed. Yet Net::FTP does resolves. So now I am making a new
> connection using Net::FTP and resolving error for login. I would like to go
> back to use Net::SSH::Perl and open a connection, create a directory, copy a
> local file to remote host and bail. Any suggestions would be appreciated.
> 

Net::SFTP and Net::FTP are very different animals.  The second is a base module used 
for plain old boring FTP which unless you have access to use it and a specific reason 
you shouldn't bother.  In your case you want the former, the good news is if you have 
Net::SSH::Perl installed and working (which it sounds as if you do) then you should 
have no problem getting Net::SFTP to work, since it mainly relies on Net::SSH::Perl.  
I would suggest installing it and reading through its docs, it can be found on CPAN 
(http://search.cpan.org/~btrott/Net-SFTP-0.05/lib/Net/SFTP.pm).

Net::SSH::Perl is for sending multiple single commands (not a typo that is what I 
mean) to a remote shell session (or a single single command depending on the protocol 
(again that is what I mean)).  And standard 'cp' is for doing "local" file system 
copies (not going to get into NFS, etc. debate).  What you are looking for is sftp/scp 
which is implemented by Net::SFTP.

Conveniently Net::SFTP also provides a 'do_mkdir' method.  A combination of the 
do_mkdir and put methods should fix you up.

A warning/caveat: Net::SFTP is significantly slower than standard openssh's 'scp' I 
suspect because the encryption/decryption is handled in Perl rather than C though 
mileage may vary. Other viable solutions are available if this becomes a problem, but 
they involve shelling out which is not nearly as elegant.

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to