AnyMQ-Pg

 view release on metacpan or  search on metacpan

inc/Test/Builder/IO/Scalar.pm  view on Meta::CPAN

    my $off  = $_[3] || 0;

    my $read = substr(${*$self->{SR}}, *$self->{Pos}, $n);
    $n = length($read);
    *$self->{Pos} += $n;
    ($off ? substr($_[1], $off) : $_[1]) = $read;
    return $n;
}

#------------------------------

#line 345

sub write {
    my $self = $_[0];
    my $n    = $_[2];
    my $off  = $_[3] || 0;

    my $data = substr($_[1], $off, $n);
    $n = length($data);
    $self->print($data);
    return $n;
}

#------------------------------

#line 366

sub sysread {
  my $self = shift;
  $self->read(@_);
}

#------------------------------

#line 380

sub syswrite {
  my $self = shift;
  $self->write(@_);
}

#line 389


#==============================

#line 398


#------------------------------

#line 408

sub autoflush {}

#------------------------------

#line 419

sub binmode {}

#------------------------------

#line 429

sub clearerr { 1 }

#------------------------------

#line 439

sub eof {
    my $self = shift;
    (*$self->{Pos} >= length(${*$self->{SR}}));
}

#------------------------------

#line 452

sub seek {
    my ($self, $pos, $whence) = @_;
    my $eofpos = length(${*$self->{SR}});

    ### Seek:
    if    ($whence == 0) { *$self->{Pos} = $pos }             ### SEEK_SET
    elsif ($whence == 1) { *$self->{Pos} += $pos }            ### SEEK_CUR
    elsif ($whence == 2) { *$self->{Pos} = $eofpos + $pos}    ### SEEK_END
    else                 { croak "bad seek whence ($whence)" }

    ### Fixup:
    if (*$self->{Pos} < 0)       { *$self->{Pos} = 0 }
    if (*$self->{Pos} > $eofpos) { *$self->{Pos} = $eofpos }
    return 1;
}

#------------------------------

#line 476

sub sysseek {
    my $self = shift;
    $self->seek (@_);
}

#------------------------------

#line 490

sub tell { *{shift()}->{Pos} }

#------------------------------

#line 503

sub use_RS {
    my ($self, $yesno) = @_;
    carp "use_RS is deprecated and ignored; \$/ is always consulted\n";
 }



( run in 2.662 seconds using v1.01-cache-2.11-cpan-98e64b0badf )