| 1 | package Net::SSH::Any::OS::POSIX::DPipe; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use Net::SSH::Any::Constants qw(SSHA_CHANNEL_ERROR); | ||
| 7 | use Net::SSH::Any::Util qw($debug _debug _debug_hexdump); | ||
| 8 | |||
| 9 | require Net::SSH::Any::OS::_Base::DPipe; | ||
| 10 | our @ISA = qw(Net::SSH::Any::OS::_Base::DPipe); | ||
| 11 | |||
| 12 | sub _upgrade_fh_to_dpipe { | ||
| 13 | my ($class, $dpipe, $any, $proc) = @_; | ||
| 14 | $class->SUPER::_upgrade_fh_to_dpipe($dpipe, $any, $proc); | ||
| 15 | $dpipe->autoflush(1); | ||
| 16 | $dpipe; | ||
| 17 | } | ||
| 18 | |||
| 19 | sub _close_fhs { | ||
| 20 | my $dpipe = shift; | ||
| 21 | close $dpipe and return 1; | ||
| 22 | $dpipe->_any->_set_error(SSHA_CHANNEL_ERROR, "Unable to close socket: $!"); | ||
| 23 | undef | ||
| 24 | } | ||
| 25 | |||
| 26 | sub syswrite { | ||
| 27 | my $dpipe = shift; | ||
| 28 | my (undef, $len, $offset) = @_; | ||
| 29 | $len ||= "<undef>"; | ||
| 30 | $offset ||= "<undef>"; | ||
| 31 | $debug and $debug & 8192 and | ||
| 32 | _debug_hexdump("$dpipe->syswrite(..., $len, $offset)", $_[0]); | ||
| 33 | $dpipe->SUPER::syswrite(@_); | ||
| 34 | } | ||
| 35 | |||
| 36 | sub send_eof { | ||
| 37 | my $dpipe = shift; | ||
| 38 | shutdown $dpipe, 1; | ||
| 39 | } | ||
| 40 | |||
| 41 | 1; |