develooper Front page | perl.perl5.porters | Postings from December 2016

[perl #130077] eof argument list context is broken

From:
James E Keenan via RT
Date:
December 31, 2016 15:31
Subject:
[perl #130077] eof argument list context is broken
Message ID:
rt-4.0.24-20886-1483198293-1696.130077-15-0@perl.org
On Sat, 12 Nov 2016 15:27:19 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::eof"'
> ;*
> 
> eof 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 eof("a", "b", "c")'
> Useless use of a constant ("a") in void context at -e line 1.
> Useless use of a constant ("b") in void context at -e line 1.
> 1
> 
> This is what happens when you try it with eof: Instead of erroring out
> (too
> many arguments) it treats it as a scalar comma operator, throwing all
> but the
> last argument away.
> 
> $ perl -MO=Deparse -e 'eof(())'
> eof ARGV;
> -e syntax OK
> 
> ... unless the argument is (). Instead of evaluating it in scalar
> context (and
> getting undef), it silently replaces it by ARGV.
> 
> 

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=130077



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About