Skip to content

Commit

Permalink
[perl #112826] Make Tie::StdHandle::READ respect offset
Browse files Browse the repository at this point in the history
Tie::StdHandle::READ was ignoring the optional fourth argument to
read(), specifying the offset into the target string.
  • Loading branch information
Father Chrysostomos committed Jun 22, 2012
1 parent c033ac4 commit 7762c37
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/Tie/Handle/stdhandle.t
Expand Up @@ -10,7 +10,7 @@ tie *tst,Tie::StdHandle;

$f = 'tst';

print "1..13\n";
print "1..14\n";

# my $file tests

Expand Down Expand Up @@ -42,6 +42,10 @@ print "ok 11\n";
$b = <$f>;
print "not " unless eof($f);
print "ok 12\n";
print "not " unless close($f);
seek($f,0,0);
read($f,($b='scrinches'),4,4); # with offset
print "'$b' not " unless $b eq 'scriSome';
print "ok 13\n";
print "not " unless close($f);
print "ok 14\n";
unlink("afile");
2 changes: 1 addition & 1 deletion lib/Tie/StdHandle.pm
Expand Up @@ -57,7 +57,7 @@ sub OPEN
@_ == 2 ? open($_[0], $_[1]) : open($_[0], $_[1], $_[2]);
}

sub READ { read($_[0],$_[1],$_[2]) }
sub READ { &CORE::read(shift, \shift, @_) }
sub READLINE { my $fh = $_[0]; <$fh> }
sub GETC { getc($_[0]) }

Expand Down

0 comments on commit 7762c37

Please sign in to comment.