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