Skip Menu |

This queue is for tickets about the Perl-Critic-Policy-Variables-ProhibitLoopOnHash CPAN distribution.

Report information
The Basics
Id: 125437
Status: resolved
Priority: 0/
Queue: Perl-Critic-Policy-Variables-ProhibitLoopOnHash

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

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



Subject: Crashes on a specific bit of code in a block
Running perlcritic on this code:' END { $dbh->do("DROP TABLE $_") foreach @table } Crashes with this error: Fatal error while critiquing "foo.pl": Can't call method "isa" without a package or object reference at /var/perl5.20.3/lib/site_perl/5.20.3/Perl/Critic/Policy/Variables/ProhibitLoopOnHash.pm line 58. The code reduces down to this that causes a crash: { print foreach @y } This does NOT crash: { print foreach 1..2 } Nor does: { print foreach @y; } Nor does: { print } Nor does: print foreach @y;
Thank you for the report, Andy! I have fixed this (and included all your examples as test cases) and you can now use version 0.005 (released on May 31st). On Wed May 30 11:09:36 2018, PETDANCE wrote: Show quoted text
> Running perlcritic on this code:' > > END { $dbh->do("DROP TABLE $_") foreach @table } > > Crashes with this error: > > Fatal error while critiquing "foo.pl": Can't call method "isa" without > a package or object reference at > /var/perl5.20.3/lib/site_perl/5.20.3/Perl/Critic/Policy/Variables/ProhibitLoopOnHash.pm > line 58. > > The code reduces down to this that causes a crash: > > { print foreach @y } > > This does NOT crash: > > { print foreach 1..2 } > > Nor does: > > { print foreach @y; } > > Nor does: > > { print } > > Nor does: > > print foreach @y;