Perl Module Monday: Perl::Critic::Bangs
A quick one this time around, so I can finish and click “Publish” while it’s still Monday…
I’m a huge fan of Perl::Critic. I use it quite regularly, and I’ve even introduced it to my day job. This said, I’ve been hesitant to use any of the “add-on” packages of extra policies. But I just installed a set that I think other users of Perl::Critic might find useful: Andy Lester’s Perl::Critic::Bangs.
This package gives you 8 new Perl::Critic policies, and I think I can use all of them without any regular disabling. The only one that I might have to disable would be the ProhibitBitwiseOperators policy, as I can see places where I might actually intentionally use bit-wise stuff, whereas this policy assumes you always meant to do something else. Of the others, I would say that ProhibitNumberedNames and ProhibitVagueNames are the ones most likely to bite me the next time I run perlcritic. But, finding these things is the reason I install tools like this.
If you like Perl::Critic, have a look at this module. It may just be useful to you, too.
Update: I learned about this module from reading Gabor Szabo’s post here. I was trying to find this link yesterday when I first wrote this, but couldn’t remember where I’d read about it. Luckily, Gabor commented below with a link to his post.
July 19th, 2011 at 1:44 AM
It’s funny I just wrote about the same module a couple of days ago specifically pointing out the unwanted bitwise operators.
Depending on the frequency of your use of the bitwise operators you might just want to mark the cases using either ## no critic
or #Violates ‘ProhibitBitwiseOperators’
July 19th, 2011 at 6:58 PM
Ah! Your post was where I discovered this module, but when I wrote my post I couldn’t find the link. Thanks for getting it to my attention!
July 19th, 2011 at 7:25 PM
I have the same issue quite often. I read a blog post from IronMan and if I don’t bookmark it immediately I cannot find later. It would be awesome if the IronMan had a little search engine behind it that indexes every blog entry it displayed.