From: Father Chrysostomos Date: Fri, 22 Jun 2012 02:02:28 +0000 (-0700) Subject: [perl #112826] Make Tie::StdHandle::READ respect offset X-Git-Tag: upstream/5.20.0~6318 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7762c3748b5616504fc9a8c5dd0c0e078d85eec5;p=platform%2Fupstream%2Fperl.git [perl #112826] Make Tie::StdHandle::READ respect offset Tie::StdHandle::READ was ignoring the optional fourth argument to read(), specifying the offset into the target string. --- diff --git a/lib/Tie/Handle/stdhandle.t b/lib/Tie/Handle/stdhandle.t index 13a8255..b1ae7c4 100644 --- a/lib/Tie/Handle/stdhandle.t +++ b/lib/Tie/Handle/stdhandle.t @@ -10,7 +10,7 @@ tie *tst,Tie::StdHandle; $f = 'tst'; -print "1..13\n"; +print "1..14\n"; # my $file tests @@ -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"); diff --git a/lib/Tie/StdHandle.pm b/lib/Tie/StdHandle.pm index 42c46b6..9192b2e 100644 --- a/lib/Tie/StdHandle.pm +++ b/lib/Tie/StdHandle.pm @@ -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]) }