Commit e1482fee authored by Bernard Quatermass's avatar Bernard Quatermass

correct buffer fill

parent dfa5affb
......@@ -42,6 +42,7 @@ new
'lastpos' => undef,
'lines' => [],
'filter' => undef,
'max_lines' => 1000,
'_qr' => undef,
} );
return $self;
......@@ -126,18 +127,15 @@ sub
_get_lines
{
my $self = shift;
my $many = shift || 0;
my $many = shift || 1000;
my (@lines,$gotqr,$nl);
$gotqr = $self->_qr;
if ($many)
{
while(
$nl = 1
if $nl > 0;
while ( ($self->max_lines > 0 && $nl)
&& (@lines = $self->fh->getlines )
)
# Already got enough buffered ?
return
if $many <= scalar @{$self->lines};
if ( @lines = $self->fh->getlines )
{
if ($gotqr)
{
......@@ -159,8 +157,8 @@ sub
activity
{
my $self = shift;
my $many = shift;
$self->_change_check;
my $many = shift || $self->max_lines;
$self->_change_check();
$self->_get_lines($many);
return scalar @{$self->lines};
}
......@@ -169,7 +167,7 @@ sub
get_line
{
my $self = shift;
return ( $self->activity ) ? shift @{$self->lines} : undef;
return ( $self->activity(1) ) ? shift @{$self->lines} : undef;
}
sub
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment