andreas1234567 has asked for the wisdom of the Perl Monks concerning the following question:
I would like Perl::Critic to behave differently depending on file type (i.e. file extension). I use emacs' cperl-mode with perlcritic-mode on test files (.t) as well as on perl modules (.pm) and perl scripts (.pl).
For example I don't want to require my test files to be contained in a package, as dictated by Perl::Critic::Policy::Modules::RequireExplicitPackage. This policy allows exceptions for perl scripts as defined by sub is_script in Perl::Critic::Utils, but there is no equivalent for test files.
I can, of course, add #! to the beginning of all test files, but I would rather solve the problem than go around it. I am thinking about a patch that adds sub is_test_script to Perl::Critic::Utils[1] and adds a parameter exempt_test_scripts to the policy.
Any guidance on the narrow path to enlightenment is appreciated.
[1] Yes, even though the source says This module is way too large.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl::Critic and file types
by rir (Vicar) on Mar 02, 2009 at 15:21 UTC | |
|
Re: Perl::Critic and file types
by elliot (Novice) on Mar 03, 2009 at 12:35 UTC |