Net::SFTP questions



I am in the process of removing the Net::FTP routines in some of my
older programs. I don't yet have the Net::SFTP and Net::SSH::Perl
modules installed (I don't have root on these systems). In the
meantime, I will probably do:

system "scp remotehost:/remotedir/remotefile /localdir/localfile";
system "ssh remotehost 'rm /remotehost/remotefile' ";

I don't like doing things this way, because if I understand correctly,
it's hard to get things to fail nicely (or fail at all) if one of the
system commands is unsuccessful.

If, and when, the Net::SFTP and Net::SSH::Perl modules get installed,
I was planning on doing something like this:

use Net::SFTP;

Net::SFTP->new($remotehost)
or die "could open connection to $remote_host\n";
$sftp->get($remotedir$remotefile)
or die "could not get $remotefile\n";
$sftp->do_remove($remotedir$remotefile)
or die "could not remove $remotedir$remotefile\n";

I am hoping that this is a sensible plan and that I've not overlooked
any serious weaknesses.

Thank you in advance for any comments and suggestions.

Don
.



Relevant Pages

  • Re: What are black dots on the skin?
    ... by removing the pigmentation one is only removing the symtom and not ... So the claim that one will not die is superficial as long ... While the bad sector on the hard disk is caused by bad usage and ...
    (soc.culture.singapore)
  • Re: Installing EncFS on SUSE 10.0
    ... You can change it back as soon as truecrypt has the random data. ... recognize tc as a command, neither as ordinary user, nor root. ... I am in the process of testing makeSUSEdvd, ... How do you ask a man to be the last man to die in Iraq? ...
    (alt.os.linux.suse)
  • Re: .bashrc problem--"ls" output and root prompt
    ... give me coloured output (executables one colour, ... Also, when I sudo'ed to root, i ... leaves me with a "$" prompt. ... Durch die Tage ohne Dich ...
    (Debian-User)
  • Re: Installing EncFS on SUSE 10.0
    ... Running "ldconfig -v" however did help. ... needed to do a `modprobe fuse`. ... Also something I tried to so as root: ... How do you ask a man to be the last man to die in Iraq? ...
    (alt.os.linux.suse)
  • Iambic Tetrameter
    ... >> Ned Ludd said: ... >>> Unless you take its root. ... >>> The tallest of the trees, ... "As if to seek to die." ...
    (talk.religion.buddhism)