##
use strict;
use Carp;
$VERSION = "1.16";
sub read {
my $data = shift;
local *buf = \$_[0]; shift;
my $size = shift || croak 'read($buf,$size,[$offset])';
my $l = 0;
my $n;
READ:
{
croak "Timeout";
${*$data}{'net_ftp_bytesread'} += $n;
? chop($readbuf)
: undef;
}
else {
return undef
unless defined $n;
}
unless (length(${*$data})) {
redo READ
if($n > 0);
if($n == 0);
}
}
}
length $buf;
}
sub write {
my $data = shift;
local *buf = \$_[0]; shift;
my $size = shift || croak 'write($buf,$size,[$timeout])';
# If the remote server has closed the connection we will be signal'd
# when we write. This can happen if the disk on the remote server fills up
my $off = 0;
my $wrote = 0;
while($len) {
croak "Timeout";
return undef
unless defined($wrote);
}
$size;
}
1;