Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Perl-Critic CPAN distribution.

Report information
The Basics
Id: 14901
Status: resolved
Priority: 0/
Queue: Perl-Critic

People
Owner: thaljef [...] cpan.org
Requestors: kclark [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.07
Fixed in: 0.10



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
Fixed in version 0.10. Returns 0 on success, 1 on error, 2 if violations were found.