in reply to Net::SFTP does not catch errors

Yup, put() sure doesn't return a status. The pod nods in the direction of saying so, by not indicating any return value. The code confirms this, with no return values for the put function. The lower level commands such as do_write, however, do return a status. You may need to roll your own ...

$sfh = $sftp->do_open($target_file ...); . . . #loop over source file, reading blocks of $data $status = $sftp->do_write($sfh, $offset, $data) &bail_out($status) if ($status != SSH2_FX_OK); . . . $sftp->do_close($sfh);

In fact, this is pretty much exactly what the put() method does, but it discards the $status. Might have a patch to submit there ...


Remember, when you stare long into the abyss, you could have been home eating ice cream.

Replies are listed 'Best First'.
Re: Re: Net::SFTP does not catch errors
by mikedshelton (Beadle) on Dec 21, 2003 at 03:26 UTC
    bug reports submitted