You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use PPI;
print PPI::Document->new($ARGV[0]), "\n";
the following trivial code fails:
sub foo {
1<<bar();
}
I am guessing it thinks the << is a heredoc, when it should be a bit shift.
The original line was
$num |= (1<<index($D_flags, $_)) for split //, $on;
which comes from this in the standard Devel/Peek.pm:
sub debug_flags (;$) {
my $out = "";
for my $i (0 .. length($D_flags)-1) {
$out .= substr $D_flags, $i, 1 if $^D & (1<<$i);
}
my $arg = shift;
my $num = $arg;
if (defined $arg and $arg =~ /\D/) {
die "unknown flags in debug_flags()" if $arg =~ /[^-$D_flags]/;
my ($on,$off) = split /-/, "$arg-"; $num = $^D;
$num |= (1<<index($D_flags, $)) for split //, $on;
$num &= ~(1<<index($D_flags, $)) for split //, $off;
}
$^D = $num if defined $arg;
$out
}
The text was updated successfully, but these errors were encountered:
I've been investigating a related issue, whereby stringifying the PPI::Document object (same as calling ->content() on it) strips out the content of heredocs, giving back an un-parseable document.
See #288 for a full description of the bug I found.
A workaround I've found in the mean time is to call ->serialize() instead of using the automatic stringification.
Using this simple round-tripper:
use PPI;
print PPI::Document->new($ARGV[0]), "\n";
the following trivial code fails:
sub foo {
1<<bar();
}
I am guessing it thinks the << is a heredoc, when it should be a bit shift.
The original line was
$num |= (1<<index($D_flags, $_)) for split //, $on;
which comes from this in the standard Devel/Peek.pm:
sub debug_flags (;$) {$i, 1 if $ ^D & (1<<$i);
$num = $ ^D;$D_flags, $ )) for split //, $on;
my $out = "";
for my $i (0 .. length($D_flags)-1) {
$out .= substr $D_flags,
}
my $arg = shift;
my $num = $arg;
if (defined $arg and $arg =~ /\D/) {
die "unknown flags in debug_flags()" if $arg =~ /[^-$D_flags]/;
my ($on,$off) = split /-/, "$arg-";
$num |= (1<<index(
$num &= ~(1<<index($D_flags, $)) for split //, $off;
}
$^D = $num if defined $arg;
$out
}
The text was updated successfully, but these errors were encountered: