Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the PPI CPAN distribution.

Report information
The Basics
Id: 23253
Status: resolved
Priority: 0/
Queue: PPI

People
Owner: Nobody in particular
Requestors: rjbs [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.199_01
Fixed in: (no value)



Subject: constant hash subscript is sometimes parsed as variable declaration
my, local, and our are not parsed correctly by PPI when used as hash keys. The attached test demonstrates the problem. -- rjbs
Subject: local-hash.t
use strict; use warnings; use Test::More tests => 7; use PPI 1.118; sub subscript_ok { my ($string) = @_; my $doc = PPI::Document->new(\"my \$y = \$x->{$string};"); my ($assignment) = $doc->schildren; my @sa_schildren = $assignment->schildren; my ($x, $arrow, $braces, $semi) = @sa_schildren[ -4 .. -1 ]; my ($subscript) = $braces->schildren; if (eval { $subscript->isa('PPI::Statement::Variable') } ) { my $type = eval { $subscript->type } || '(undef)'; fail "\$x->{$string} shows subscript is a variable of type $type"; } else { pass "\$x->{$string} shows subscript is a non-variable expression"; } } subscript_ok('foo'); subscript_ok('bar'); subscript_ok('baz'); subscript_ok('local'); subscript_ok('my'); subscript_ok('our'); subscript_ok('state');
From: CDOLAN [...] cpan.org
On Tue Nov 14 10:00:16 2006, RJBS wrote: Show quoted text
> my, local, and our are not parsed correctly by PPI when used as hash keys. > > The attached test demonstrates the problem.
Added a simplified failing test to PPI SVN. Thanks RJBS! -- Chris
Confirming this was resolved a while back