Domanda

I want to use module Perl::Critic::Policy::ValuesAndExpressions::ProhibitMagicNumbers to check for magic numbers only in a .C file

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);

If I Use Perl::Critic, I get error Can't parse code: Unknown error parsing Perl document

If I use Perl::Critic::Policy::ValuesAndExpressions::ProhibitMagicNumbers, I get error Can't locate object method "new" via package "Perl::Critic"

È stato utile?

Soluzione

Perl::Critic parses Perl, not C.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top