This looks like the right thing to me (but makes t/op/flip fail test 10).
--- opcode.pl.orig Mon Feb 11 16:25:16 2002
+++ opcode.pl Thu Feb 21 17:53:54 2002
@@ -480,7 +480,7 @@
backtick quoted execution (``, qx) ck_open t%
# glob defaults its first arg to $_
glob glob ck_glob t@ S?
-readline <HANDLE> ck_null t% F?
+readline <HANDLE> ck_fun t% F
rcatline append I/O operator ck_null t$
# Bindable operators.
End of Patch.
For prior art on this subject, see:
[ID 20001018.008] flip-flop bug when there's no <FH>
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-10/msg00777.html
This thread left the discussion of what to do when $. is manually set but
there's no last input file kind of up in the air. I think one of the
following would be appropriate:
a) doc setting $. having unreliable effect on flipflops and change the
test to only test for coredump, not the result of ..
b) make: perl -le'sub t{$.=1; print "ok" if 1..10} t; readline NOSUCHHANDLE; t'
print two oks. remove test 10 and add these
and
[ID 20010621.007] readline() not quite as equal as <>
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-06/msg01225.html
The latter left off at:
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-06/msg01487.html
saying:
"The appended patches revert to the original behaviour, with the sole
exception that -Mstrict doesn't complain about C<readline FH>. Jarkko,
you may want to apply these until I have had a chance to investigate
further."
I can see leaving things as they are *if* you always got the warning:
~/bleadperl/perl $./perl -we'readline'
Use of uninitialized value in <HANDLE> at -e line 1.
readline() on unopened filehandle at -e line 1.
But that warning isn't always triggered:
~/bleadperl/perl $./perl -we'$_=ARGV;$_=readline'
Modification of a read-only value attempted at -e line 1.
Don't ask me what's being modified, I'm clueless.
No warning at all (just very strange results) in this case:
~/bleadperl/perl $cat >a
anne bronte
jane austen
~/bleadperl/perl $./perl -we'1for"ARGV",print readline' a
jane austen
Also:
~/bleadperl/perl $./perl -Ilib -MO=Deparse -e'readline'
Can't locate object method "first" via package "B::OP" at lib/B/Deparse.pm line
1599.
All this behaviour is consistent between 5.6.1 and bleadperl (except the
Deparse line number :)
Thread Next