critic.pl



NAME

critic.pl <glob>


DESCRIPTION

Audit Perl files against Perl Best Practices book.


COPYRIGHT

Copyright 2010 Etienne LEMEE <coding AT etilem DOT net>

This piece of code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


#!/usr/bin/perl -w

use strict;
use Perl::Critic;

@ARGV > 0 or die << "USAGE";
usage: $0 <glob>
audit Perl files against Perl Best Practices book.
USAGE

my $critic = Perl::Critic->new();
for (@ARGV) {
    -f $_ or next;
    my @res = $critic->critique($_) or next;
    print "===\nFor $_ :\n", @res, "\n";
}