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: 48819
Status: resolved
Priority: 0/
Queue: PPI

Owner: Nobody in particular
Requestors: stolen-from-cpan-rt [...]

Bug Information
Severity: (no value)
Broken in: 1.206
Fixed in: (no value)

Download (untitled) / with headers
text/plain 436b
A run I did of an older Perl::Critic (1.082) with the current version of PPI exposed a bug in the code that warns about the deprecated PPI::Structure::ForLoop element. Hitting this section of the code caused a fatal error when an attempt was made to call the "type" method (nonexistent) for PPI::Structure::List. The attached patch cured the problem for me. I also brought in Carp so that the warning would give more useful context.
Subject: forloop-deprecation-fix.patch
--- 2009-08-18 17:34:23.000000000 -0700 +++ 2009-08-18 17:42:25.000000000 -0700 @@ -38,6 +38,9 @@ use strict; use PPI::Structure (); +use Carp; +$Carp::CarpLevel = 1; + use vars qw{$VERSION @ISA}; BEGIN { $VERSION = '1.206'; @@ -52,10 +55,10 @@ if ( $_[0]->parent->isa('PPI::Statement::Compound') and - $_[0]->type =~ /^for/ + $_[0]->parent->type =~ /^for/ ) { unless ( $has_warned ) { - warn("PPI::Structure::ForLoop has been deprecated"); + carp("PPI::Structure::ForLoop has been deprecated"); $has_warned = 1; } return 1;
Yeah, probably better to use a "local" in there.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to