In: Articles27 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.
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.