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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.