develooper Front page | perl.perl5.porters | Postings from July 2013

[perl #78348] => search too weak

Thread Next
From:
Father Chrysostomos via RT
Date:
July 12, 2013 08:19
Subject:
[perl #78348] => search too weak
Message ID:
rt-3.6.HEAD-2552-1373617147-142.78348-15-0@perl.org
Here is another instance of this bug.

OK, so => quotes a bare word:

$ perl -le 'sub foo; $_ = foo => ' -e 'print $_'
foo

even if it is on the following line:

$ perl -le '$_ = foo ' -e '=> print $_'
foo

Let’s try __DATA__:

$ perl -le '$_ = __DATA__ =>' -e 'print $_'
__DATA__

$ perl -le '$_ = __DATA__' -e '=> print $_'
syntax error at -e line 1, at EOF
Execution of -e aborted due to compilation errors.

Now that happens to apply to any built-in keyword.  I am trying to fix
that.  But __DATA__ and __END__ are special.

Do we want this to quote __DATA__?

__DATA__
######################################################################
#
#  !!!!! Do NOT edit this file directly! -- Edit foo.PL instead. !!!!!
#
#  This file was automatically generated from the definition files in
#  the bar/ subdirectory by foo.PL.  To learn more about how all this
#  works, and also about coughing, please read the HACKERS file that
#  came with this distribution.
#
###########################################################################
=>

(Apologies to the authors of Devel::PPPort.)

I think we *do* want it to.  => needs to be generic.  For a keyword to
say ‘nope, sorry, => doesn’t apply to me, er, in *this* context’ doesn’t
seem right.  (Yes, I am thinking of __DATA__ as being conceptually a
special function that gobbles up the rest of the input as its ‘argument’
and opens the DATA handle at the current point in the file.)

BTW:

$ perl -le 'print eval "__DATA__\n\n\n=>"'
__DATA__

But it doesn’t work with comments.

-- 

Father Chrysostomos


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

Thread Next


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