http://www.perlmonks.org?node_id=526387

First, I want to thank everyone who responded to my request for comments on Perl::Critic. Based on your invaluable feedback, we've made a number of signficant enhancements:

So once again, I welcome any ideas, comments, or complaints. The lastest version of Perl::Critic is on CPAN now. Thanks, and 'Gung Hay Fat Choy!'

-Jeff

Replies are listed 'Best First'.
Re: Announcing Perl-Critic-0.14
by simon.proctor (Vicar) on Jan 30, 2006 at 09:55 UTC

    A product I use quite a lot is FxCop for .NET. Ignoring the fact that it is for .NET it has some quite nice features.

    One feature I like especially (hence my comment here) is that each rule can point to the FxCop website with a discussion on the guideline and a code example that:

    • Breaks the rule
    • Shows the fix

    Perhaps this is something that could be added? Certainly links to perlfaq where relevant. I realise you are citing the PBP book and point people at the pages in there but why not extend it a little more? It may help newer programmers who may not have the book or have the book to hand. It would also allow you to add more rules that are not necessarily from PBP but from other sources of knowledge such as this site.

    Just a thought :)

      That's a great idea! I'm planning to support links to the Safari pages for PBP. Adding links to perlfaq or perlstyle should be doable too. In the meantime, you can get more information from perlcritic by using the "--verbose" option. For example...
        perlcritic --verbose=9 MyModule
      
      ...will add a complete discussion of the policy (including examples) to each violation. These are just pulled from the POD of the appropriate Perl::Critic::Policy subclass. You can also customize the output format to your liking. See the "--verbose" option in the perlcritic docs for more details.

      Thanks again for the suggestion!

      -Jeff
Re: Announcing Perl-Critic-0.14
by ghenry (Vicar) on Jan 30, 2006 at 09:06 UTC

    This fixes a bug I hit when installing Perl-Critic, which was actually down to PPI. Great!

    I would recommmend that Perl-Critic be in beginners toolkits too, as it's very nice to just run this over your code and see if you may have done anything stupid.

    It's so nice to see module authors working together with regard to releases, just look at the PPI changes for evidence.

    I love the Perl community.
    Gavin.

    Walking the road to enlightenment... I found a penguin and a camel on the way.....
    Fancy a yourname@perl.me.uk? Just ask!!!
Re: Announcing Perl-Critic-0.14
by perrin (Chancellor) on Jan 30, 2006 at 16:12 UTC
    Can you make it catch this coding mistake?
    my $foo = 1 if $bar;
    I've been bitten by that before, and never want it to happen again.
      Please forgive my ignorance, but what's wrong with it? $foo ends up as 1 when $bar is true and is undefined when $bar is false. Just as I expect it to be. (Active Perl 5.8.7)
      use warnings; use strict; my $t_bar = 1; my $t_foo = 1 if $t_bar; my $f_bar = 0; my $f_foo = 1 if $f_bar; print "true $t_foo false $f_foo"; #->true 1 false #->Use of uninitialized value in concatenation (.) or string ...


      holli, /regexed monk/
        Please forgive my ignorance, but what's wrong with it? $foo ends up as 1 when $bar is true and is undefined when $bar is false. Just as I expect it to be. (Active Perl 5.8.7)
        Wrong. This piece of code is one of the weird things in perl, in this case, something that is sometimes used as a dirty trick, to create a static variable.
        #!/usr/bin/perl -lw print $]; for (1 .. 5) { my $i = 123 if $bar; print ++$i; }
        Result:
        Name "main::bar" used only once: possible typo at test.pl line 4. 5.008003 1 2 3 4 5
      We just added that. It will be available in version 0.15 which should be released by the end of March. Thanks for the great suggestion.