develooper Front page | perl.perl5.porters | Postings from April 2003

Re: [PATCH] [perl #21875] Hash ref transformed as a list

Thread Previous | Thread Next
Dave Mitchell
April 9, 2003 03:59
Re: [PATCH] [perl #21875] Hash ref transformed as a list
Message ID:
On Tue, Apr 08, 2003 at 11:22:38PM +0200, Rafael Garcia-Suarez wrote:
> Dave Mitchell wrote:
> > And here's a patch for the actual bug. It turns out that the hash / block
> > disambiguator code in toke.c got confused when seeing "{ q".
> > After looking for, and failing to find a q//-type construct, it wasn't going
> > back and checking whether the thing starting with a q was a plain word
> > instead.
> Have you a test case or something ? Your patch doesn't work for me,
> so I'd like to know with what you tested it.

Ah yes, a test case - how silly of me to forget ...

My patch just fixes the

    { bareword_starting_with_q =>

case, it doesnt fix the

    { q =>

case, since while the first is clearly a bug, the second may (or may
not) be a feature, since that could legitimately be a q=string= quoting
construct. Ie it skips to the matching = as being the end of the term,
then fails to see a following comma or =>, so assumes it's not a hash.  I
could update the patch to treat /{\s*q[qx]?\s+=>/ as a special case if
people want. Also, I notice that it doesn't check for qw and qr.  Should I
add these?

Finally, where should the test go? t/op/parser.t ??

Blaming Islam for 911 is like blaming Christianity for Oklahoma City.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About