develooper Front page | perl.perl5.porters | Postings from January 2012

[perl #78348] => search too weak

From:
James E Keenan via RT
Date:
January 13, 2012 18:30
Subject:
[perl #78348] => search too weak
Message ID:
rt-3.6.HEAD-14510-1326508206-929.78348-15-0@perl.org
On Tue Oct 12 11:58:29 2010, zefram@fysh.org wrote:
> 
> This is a bug report for perl from zefram@fysh.org,
> generated with the help of perlbug 1.36 running under perl 5.10.0.

> 
> The determination of whether a "{" is the start of a block or a hash
> constructor depends in part on looking for "=>" following an initial
> bareword.  This search gives up at end of line:
> 
> $ perl -lwe '{ foo => 1 }->${\sub{ print @_ }}'
> HASH(0x1e1edf0)

> $ perl -lwe '{ foo '$'\n'' => 1 }->${\sub{ print @_ }}'
> syntax error at -e line 2, near "}->"
> Execution of -e aborted due to compilation errors.

My subjective reaction to that last line of code is:  "Whoever writes
code that ugly gets what he deserves."

> 
> It should really be willing to add the next line to the buffer, and do
>    a
> full skipspace() job.  

Less subjectively, I feel we should ask:  Do we really need this
functionality?

> However, because it's looking ahead of the
>    current
> lexing point, there's some trickiness about restoring lexing state
>    back
> to the "{".
> 

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=78348



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