Enter your e-mail to receive occasional updates:
Perl Critic for BBEdit is a free script plugin for the BBEdit text editor to enable Perl programmers to check their code format against the style guidelines of the Perl Best Practices book by Damian Conway. A nifty tool to help keep your code tidy. Free.
Updated July 27, 2009: Version 1.1 adds a compatibility fix for Perl::Critic version 1.094 and later.
Perl Critic for BBEdit is a free AppleScript plugin for the BBEdit text editor that lets Perl programmers check their code against the style recommendations of Damian Conway's book, Perl Best Practices. Warnings are displayed in the results browser just like BBEdit's built-in Perl and HTML syntax checkers.
Perl Critic for BBEdit requires Mac OS X 10.3.9 or later. It's been tested against BBEdit 8.2.6, 8.5, and 9.2.1. The Perl::Critic module must be installed.
These scripts are free and are released under a Creative Commons Attribution-ShareAlike License.
Perl Critic for BBEdit owes its existence to three people, whose works I can't recommend enough.
Jeffrey Ryan Thalhammer is creator of the Perl::Critic module, which Perl Critic for BBEdit relies upon for all the dirty work. Perl::Critic analyzes Perl code for compliance with style and syntax rules. Most of these rules are based on the recommendations of the Perl Best Practices book, but the system is not especially dogmatic. You can customize the ruleset so that it enforces just the style rules that fit your particular preferences or house style guide.
Perl Critic for BBEdit consists of two script files, one AppleScript and one Perl:
(A third file named
perlcriticrc is also enclosed, more on that in a sec.)
Put both scripts in your BBEdit scripts folder:
Open a Perl script in BBedit and choose "Perl Critic" from the Scripts menu. It will probably take a second or two to run, but can take several seconds for longer scripts or those that have a large number of warnings.
Any Perl Critics warnings will appear in a results browser, along with references to the Perl Best Practices page numbers that describe the problem, if applicable. Double clicking the item in the results browser takes you to the line of code that presents the problem.
The Perl::Critic module allows you to customize the rules to be enforced by adding a configuration file to your home directory (
/Users/yourname). The details are described in the Perl::Critic documentation. The configuration file lets you name a style rule and then set the severity of that rule on a scale of 1 to 5, with 5 being most important.
The included file
perlcriticrc is a sample configuration file. Edit it as you see fit, put it in your home directory, and rename it as
.perlcriticrc (i.e., precede the name with a dot).
By default, Perl Critic for BBedit flags any rule violation with a severity of 2 or more. You can change this by editing the
Perl Critic.pl file:
# severity is a number from 1 to 5 that determines what level of warnings to # report; the lower the value, the more strict the warnings and, probably, # the more warnings you'll receive my $SEVERITY = 2;