in reply to Updating files over multiple servers
use Net::SFTP::Foreign; use Net::SFTP::Foreign::Constants qw(SSH2_FXF_WRITE SSH_FXF_READ); my $sftp = Net::SFTP::Foreign->new('user@remote-host'); $sftp->error and die "unable to connect to remote host: ".$sftp->error +; my $fh = $sftp->open("remote/file/path", SSH2_FXF_WRITE|SSH2_FXF_READ) or die "unable to open remote file: ". $sftp->error; seek($fh, 0, 2); print $fh "append this line to file\n"; close $fh;
|
|---|