sub write { @_ == 3 or croak 'Usage: $sftp->write($fh, $data)'; my ($sftp, $rfh) = @_; $sftp->flush($rfh, 'in') or return undef; if (utf8::is_utf8($_[2])) { splice(@_, 2, 1, "$_[2]"); # Don't affect caller. utf8::downgrade($_[2], 1) # Change format to bytes. or carp("Can only write bytes to a socket"); } ...