Carrot
view release on metacpan or search on metacpan
lib/Carrot/Continuity/Coordination/Episode/Paragraph/File_IO.pm view on Meta::CPAN
sub evt_fd_nonstop_write
# /type method
# /effect ""
# //parameters
# //returns
{
my ($this) = @ARGUMENTS;
return if ($this->[ATR_OBUF_STATE] == BST_CLOSED); # no point
if (length($this->[ATR_OBUF]) == 0) { # $n == 0 indicates eof
$this->[ATR_IO_UNBLOCKED_OUT]->fd_ignore_write;
$this->[ATR_PROTOCOL]->evt_fdx2_io_pending_output(IS_FALSE);
return;
}
WRITE: {
my $n = syswrite(STDOUT, $this->[ATR_OBUF], $syswrite_size);
unless (defined($n))
{
#FIXME: log $OS_ERROR
return if ($this->is_temporary_error());
$this->destructor;
return;
};
if ($n == 0) { # eof
$this->destructor;
return;
}
substr($this->[ATR_OBUF], 0, $n, '');
}
if (length($this->[ATR_OBUF]) == 0)
{
$this->[ATR_IO_UNBLOCKED_OUT]->fd_ignore_write;
$this->[ATR_OBUF_STATE] = BST_IDLE;
$this->[ATR_PROTOCOL]->evt_fdx2_io_pending_output(IS_FALSE);
}
return;
}
sub is_temporary_error
# /type method
# /effect ""
# //parameters
# //returns
# ::Personality::Abstract::Boolean
{
if (($OS_ERROR == EAGAIN)
or ($OS_ERROR == EINTR)
or ($OS_ERROR == EINPROGRESS)
or ($OS_ERROR == ENOMEM)) {
return(IS_TRUE);
}
return(IS_FALSE);
}
sub is_alive
# /type method
# /effect ""
# //parameters
# //returns
# ::Personality::Abstract::Boolean
{ return(1) }; # FIXME
sub attribute_destruction
# /type method
# /effect "Destructs the attributes of an instance (breaks circular references)"
# //parameters
# //returns
{
my ($this) = @ARGUMENTS;
$this->[ATR_IO_UNBLOCKED_IN]->deactivate;
$this->[ATR_IO_UNBLOCKED_OUT]->deactivate;
# my $fd = fileno($this->[ATR_SOCKET]);
# POSIX::close($fd) || warn("FD$fd: close: $OS_ERROR");
$this->[ATR_PROTOCOL]->evt_fdx2_io_drop;
return;
}
sub set_bst_in_closed
# /type method
# /effect ""
# //parameters
# //returns
{
$_[THIS][ATR_IBUF_STATE] = BST_CLOSED;
$_[THIS][ATR_IO_UNBLOCKED_IN]->fd_ignore_read;
return;
}
sub set_bst_out_closed
# /type method
# /effect ""
# //parameters
# //returns
{
$_[THIS][ATR_OBUF_STATE] = BST_CLOSED;
$_[THIS][ATR_IO_UNBLOCKED_OUT]->fd_ignore_write;
return;
}
#sub is_bst_in { return($_[THIS][ATR_IBUF_STATE] == BST_CLOSED); };
#sub is_bst_out { return($_[THIS][ATR_OBUF_STATE] == BST_CLOSED); };
sub DESTROY
# /type method
# /effect ""
# //parameters
# //returns
{
foreach my $attribute (ATR_IO_UNBLOCKED_IN, ATR_IO_UNBLOCKED_OUT)
( run in 1.276 second using v1.01-cache-2.11-cpan-56fb94df46f )