Yet Another New Perl::Critic policy in the pipeline: RequirePackageNamePattern

In: Articles

27 Nov 2013

I have written up a first working version of yet another Perl::Critic policy, also this policy suggestion is highly experimental.

The policy assists in enforcing a package/module/class naming strategy, so if you prefer to have your modules names follow a certain pattern this policy could be of interest to you.

If you do not configure the policy it does not do anything. You can however configure it with as many patterns as you would like:

Patterns could look as follows:

^Acme # if you want all of you modules to start with Acme
Acme # if you want all of your modules to contain the work Acme
Acme$ # if you want all of you modules to end with Acme

For now you can only specify global patterns, but I was considering looking into the ability to specify different patterns for different directories:

lib = <pattern1> || <pattern2>
t = <pattern1> || <pattern3>

And creating more complex patterns would also be great, like:



^Acme && Test$

In addition the policy has the following configurable parameters:

- debug (for debugging)

- exempt_programs, so scripts etc. are not evaluated, these can however be of interest if you use inline packages

The motivation is to use the policy as a part of a coding standard for use at my work place, but I have developed it in my spare time since I wanted to contribute it to CPAN and as for my other policies I would like too use it on my own open source code base to begin with.

I will pack it up and push it to CPAN in a few days, but you are welcome to check it out on Github, please note that the policy is by no means done and much work remains.

jonasbn, logicLAB

Comment Form

About this blog

This blog acts as a channel for communicating logicLAB’s open source activities. Announcements on open source initiatives, involvements and releases of open source distributions of software products, projects and applications.


  • » Blog Archive » Some Modules I’m Looking At Currently: [...] learned of this module from this blog post, and am both intrigued and frustrated. Intrigued, b [...]
  • jonasbn: The Test::More package has been added to SublimeText's package control. So the installation proce [...]
  • jonasbn: Hello Stas, I am just a software developer blogging about stuff that interests me like computer p [...]
  • Stas Ustimenko: Hi. We would like to add review of our free PHP IDE - Codelobster PHP Edition http://www.codelo [...]
  • jonasbn: Just a brief note, on twitter the new editor 'Atom' is generating a lot of (f|b)uzz: http://daily [...]


November 2013
« Jul   Jan »