我想使用模块 Perl::Critic::Policy::ValuesAndExpressions::ProhibitMagicNumbers仅在 .C 文件中检查幻数
use strict;
use warnings;
use Perl::Critic;
open(my $FILE, "< test.c") or die $!;
my $critic = Perl::Critic->new();
my @violations = $critic->critique($FILE);
print @violations;
close($FILE);
如果我使用 Perl::Critic,我得到错误 Can't parse code: Unknown error parsing Perl document
如果我使用 Perl::Critic::Policy::ValuesAndExpressions::ProhibitMagicNumbers,我得到错误 Can't locate object method "new" via package "Perl::Critic"