Subject: | perlcritic output |
I think the output of "perlcritic" is slightly wrong. The result of "print_status" (the number of errors found) is returned as the exit status -- shouldn't the exit status be one of 0, 1 or 2? I'm not sure about that, but I'm pretty sure an exit status of "37" isn't standard. Also, I like how "perl -cw" returns "Syntax OK" if all is well, so here are my changes to act like that:
$ diff -c /tmp/perlcritic.orig perlcritic
*** /tmp/perlcritic.orig 2005-10-03 18:18:10.000000000 -0400
--- perlcritic 2005-10-03 18:18:23.000000000 -0400
***************
*** 73,80 ****
}
sub print_report {
! for my $v (@_){ print "$v\n" }
! return scalar @_;
}
--- 73,89 ----
}
sub print_report {
! if (@_) {
! print scalar @_, " errors\n";
! for my $v (@_) {
! print "$v\n";
! }
! }
! else {
! print "Syntax OK\n";
! }
!
! return 0;
}
Also, FWIW, "perlcritic" fails itself with 5 errors. D'oh! It's hard to be perfect. :-)
ky