On Sat, 12 Nov 2016 15:13:51 GMT, mauke- wrote: > > This is a bug report for perl from l.mai@web.de, > generated with the help of perlbug 1.40 running under perl 5.24.0. > > > ----------------------------------------------------------------- > [Please describe your issue here] > > $ perl -wE 'say prototype "CORE::readline"' > ;* > > readline claims to take a single (optional) scalar argument. > > $ perl -wE 'sub foo (;*); foo("a", "b", "c")' > Too many arguments for main::foo at -e line 1, near ""c") > " > Execution of -e aborted due to compilation errors. > > This is what happens when you use the same prototype on a sub. > > $ perl -wE 'say readline("a", "b", "c")' > readline() on unopened filehandle at -e line 1. > ab > > This is what happens when you try it with readline: Only the last > argument is > used; the rest leak through to say. No error is reported. > > $ perl -wE 'say readline(1 .. 10)' > readline() on unopened filehandle 10 at -e line 1. > 123456789 > > Despite what the prototype claims, the argument is evaluated in list > context. > > $ perl -wE 'say "foo", "bar", readline(())' > readline() on unopened filehandle at -e line 1. > foo > > If you call it with an empty list, it steals arguments from the > surrounding > context (it tries to read from "bar"). > Is this problem similar to that reported by sprout in https://rt.perl.org/Ticket/Display.html?id=93992? -- James E Keenan (jkeenan@cpan.org) --- via perlbug: queue: perl5 status: new https://rt.perl.org/Ticket/Display.html?id=130076Thread Next