Carrot
view release on metacpan or search on metacpan
lib/Carrot/Continuity/Coordination/Episode/Paragraph/TCP_Socket_IO/Buffer/Output.pm view on Meta::CPAN
return;
}
sub data
# /type method
# /effect ""
# //parameters
# //returns
# ?
{
my ($this) = @ARGUMENTS;
if (($this->[ATR_STATE] == BST_CLOSED)
or ($#{$this->[ATR_CHUNKS]} == ADX_NO_ELEMENTS))
{
return([@$empty_chunk]);
}
return($_[THIS][ATR_CHUNKS][ADX_FIRST_ELEMENT]);
}
sub written
# /type method
# /effect ""
# //parameters
# amount
# //returns
# ?
{
my ($this, $amount) = @ARGUMENTS;
my $chunks = $this->[ATR_CHUNKS];
my $first_chunk = $chunks->[ADX_FIRST_ELEMENT];
$first_chunk->[BUF_OFFSET] += $amount;
$first_chunk->[BUF_LEFT] -= $amount;
$this->[ATR_SIZE] -= $amount;
if ($first_chunk->[BUF_LEFT] == 0)
{
if ($first_chunk->[BUF_IS_FILE])
{
close($first_chunk->[BUF_CONTENT]);
}
shift(@$chunks);
}
return($this->update);
}
sub add_file_handle
# /type method
# /effect ""
# //parameters
# data
# //returns
# Mica::Projection::Flow_Control
{
my ($this) = @ARGUMENTS;
return(FLOW_STOP) if ($this->[ATR_STATE] == BST_CLOSED);
my $l = (stat($_[SPX_DATA]))[7];
return(FLOW_NOCHANGE) if ($l == 0);
push(@{$this->[ATR_CHUNKS]}, [$_[SPX_DATA], 0, $l, 1]);
$this->[ATR_SIZE] += $l;
return($this->update);
}
sub add_scalar
# /type method
# /effect ""
# //parameters
# data
# //returns
# Mica::Projection::Flow_Control
{
my ($this) = @ARGUMENTS;
return(FLOW_STOP) if ($this->[ATR_STATE] == BST_CLOSED);
my $l = length(${$_[SPX_DATA]});
return(FLOW_NOCHANGE) if ($l == 0);
push(@{$this->[ATR_CHUNKS]}, [$_[SPX_DATA], 0, $l, 0]);
$this->[ATR_SIZE] += $l;
return($this->update);
}
sub update
# /type method
# /effect ""
# //parameters
# //returns
# Mica::Projection::Flow_Control
{
my ($this) = @ARGUMENTS;
return(FLOW_STOP) if ($this->[ATR_STATE] == BST_CLOSED);
if (($#{$this->[ATR_CHUNKS]} == ADX_NO_ELEMENTS)
or ($this->[ATR_CHUNKS][ADX_LAST_ELEMENT][BUF_LEFT] == 0))
{
if ($this->[ATR_STATE] == BST_OPEN)
{
$this->[ATR_STATE] = BST_PAUSED;
return(FLOW_STOP);
}
} else {
if ($this->[ATR_STATE] == BST_PAUSED)
{
$this->[ATR_STATE] = BST_OPEN;
return(FLOW_START);
}
}
return(FLOW_NOCHANGE);
}
# =--------------------------------------------------------------------------= #
return(PERL_FILE_LOADED);
}
( run in 0.564 second using v1.01-cache-2.11-cpan-ceb78f64989 )