Hi.
I'm not able to test it, as I don't have Perl Critic installed, but...
Firstly have you considered using the perlcritic command line tool?
Secondly, whether using command line or the module, I think you've used the parameter name format instead of verbose.
Finally, the number 1 that you send to format/verbose doesn't seem to include the severity that you want. It seems from the documentation that you need to use a number 4 or greater. However, I'm not sure if those numbers apply to the module or just the command line, but you could you include the literal format specification.
In short, try changing your script to this:
use strict; use warnings; use Perl::Critic qw(critique); my ($FILE) = $ARGV[0]; # Use custom parameters... # # If 4 doesn't work for verbose, try putting the string # "%m at line %l, column %c. %e. (Severity: %s)\n" # (or whatever you want) in its place. my @violations = critique( { -verbose => 4 }, $FILE ); foreach ( @violations ) { print $_,"\n"; }
Sorry for the formatting, not used to editing code in a web form...
Hope this helps. Can't be sure because I can't test it. Post and say if it helps or not, and someone else who knows better may come along...
FVS
Update: PS. I noticed you're using strict, but not warnings. It's good style to use both and it may help you find errors.
In reply to Re: Perl::Critic usage
by FalseVinylShrub
in thread Perl::Critic usage
by kalyanrajsista
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |