Since you said that you are trying to do this without creating a local file, the previous response doesn't really answer the question. Reading the source, the flags for open are the Constants prefixed with SSH2_FXF_. Specifically,
'SSH2_FXF_READ' => 0x01, 'SSH2_FXF_WRITE' => 0x02, 'SSH2_FXF_APPEND' => 0x04, 'SSH2_FXF_CREAT' => 0x08, 'SSH2_FXF_TRUNC' => 0x10, 'SSH2_FXF_EXCL' => 0x20,
Which should look familiar to anyone who has ever opened a file à la C. You say you want to append to an existing remote file, so you do not need READ, CREAT(e), TRUNC(ate) or EXCL(ude). You do need WRITE and APPEND, so your flags are:
SSH2_FXF_WRITE | SSH2_FXF_APPEND
(Remember that you OR flags when you want them both)
Update: As is pointed out by insaniac, this is not the only code change. You either neet to use the hex listed above (less portable) or follow the instructions in the docs:
use Net::SFTP::Constants qw( SSH2_FXP_WRITE SSH2_FXF_APPEND );
In reply to Re: sftp->do_write howto?
by idsfa
in thread sftp->do_write howto?
by chrism01
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |