New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
while(<>) doesn't become while(defined($_=<>)) if CORE::GLOBAL::readline is overridden #11150
Comments
From andrew@cleverdomain.orgOrdinarily, Perl changes a construct like while(<>) or This is because when CORE::GLOBAL::readline is overriden, S_scan_inputsymbol This is fairly low-impact since it only affects people who use (This affects every perl since at least 2002 up to blead). |
From mobrule@gmail.comPerl's behavior that treats the expressions while (<HANDLE>) as equivalent to while (defined($_=readline(HANDLE))) breaks when &CORE::GLOBAL::readline is defined. This makes it Demo: BEGIN { This script fails as written but passes if you comment out the BEGIN block. Another demo: Compare: $ perl -MO=Deparse -e 'print while <>' with: $ perl -MO=Deparse -e 'BEGIN{*CORE::GLOBAL::readline=sub{}}' \ See also: http://stackoverflow.com/questions/5081767/. If this isn't a bug, then it is at least underdocumented. |
@jkeenan - Status changed from 'new' to 'open' |
Migrated from rt.perl.org#84690 (status was 'open')
Searchable as RT84690$
The text was updated successfully, but these errors were encountered: