Skip Menu |

This queue is for tickets about the Perl-Critic-Moose CPAN distribution.

Report information
The Basics
Id: 128988
Status: open
Priority: 0/
Queue: Perl-Critic-Moose

People
Owner: Nobody in particular
Requestors: ahmed.iabdrabo [...] gmail.com
Cc:
AdminCc:

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



Subject: Bug with Perl::Critic::Policy::Moose::RequireMakeImmutable
Date: Mon, 1 Apr 2019 13:00:59 +0200
To: bug-perl-critic-moose [...] rt.cpan.org
From: Ahmed Abdrabo <ahmed.iabdrabo [...] gmail.com>
Hi, I faced a weird issue while running perlcritic on some code in my company. You can reproduce the issue with having __DATA__ string in the source code. Notice the only difference in the following two examples is __DATA__ vs somethingelse but Moose::RequireMakeImmutable behaves differently in both cases. $ echo ' use Moose; sub foo { $bar->{__DATA__}++; } no Moose; __PACKAGE__->meta->make_immutable; 1; ' | perlcritic --profile /dev/null -s RequireMakeImmutable --verbose 9 [Moose::RequireMakeImmutable] No call was made to make_immutable() at line 1, near ''. (Severity: 3) $ echo ' use Moose; sub foo { $bar->{somethingelse}++; } no Moose; __PACKAGE__->meta->make_immutable; 1; ' | perlcritic --profile /dev/null -s RequireMakeImmutable --verbose 9 source OK My installed Perl-Critic-Moose version is 1.05. Regards, Ahmed
On 2019-04-01 06:01:28, ahmed.iabdrabo@gmail.com wrote: Show quoted text
> Hi, > > I faced a weird issue while running perlcritic on some code in my company. > You can reproduce the issue with having __DATA__ string in the source code. > Notice the only difference in the following two examples is __DATA__ > vs somethingelse but Moose::RequireMakeImmutable behaves differently in > both cases. > > $ echo ' > use Moose; > > sub foo { $bar->{__DATA__}++; } > > no Moose; > __PACKAGE__->meta->make_immutable; > > 1; > ' | perlcritic --profile /dev/null -s RequireMakeImmutable --verbose 9 > [Moose::RequireMakeImmutable] No call was made to make_immutable() at line > 1, near ''. (Severity: 3) > > > $ echo ' > use Moose; > > sub foo { $bar->{somethingelse}++; } > > no Moose; > __PACKAGE__->meta->make_immutable; > > 1; > ' | perlcritic --profile /dev/null -s RequireMakeImmutable --verbose 9 > source OK > > My installed Perl-Critic-Moose version is 1.05.
That is an odd bug. I'm not sure what's going on though I suspect it has something to do with how PPI handles the `__DATA__` token, and the bug is probably in that package.