in reply to Net::SFTP and reget ?

Net::SFTP seems to support it:

$sftp->do_write($handle, $offset, $data) ^^^^^^^ $sftp->do_read($handle, $offset, $copy_size) ^^^^^^^

You can find out how big the file is on the remote end using do_stat.

Replies are listed 'Best First'.
Re^2: Net::SFTP and reget ?
by Anonymous Monk on Nov 15, 2005 at 19:13 UTC
    Fair point, but there's no high level reget method with the same signature as the get method (in partic. with a callback) so it'd be painful to have to perform regets with do_write

    Steve.

      All you need to do is copy the get function and edit the line my $offset = 0;

      Update: How about:

      sub get_from { my $sftp = shift; my($remote, $local, $cb, $from) = @_; ... my $offset = $from || 0; ... }

      The last argument is optional. If not supplied, get_from is the same as get. If supplied, the transfer will start at that offset. You can find out at which byte to start using stat on the local file. You'll need to make no other changes are needed.

        Yeah, I guess I can derive from Net::SFTP and implement a reget along these lines. Thanks.

        Steve.