|Think about Loose Coupling|
Dist::Zilla::Plugin::PkgVersion vs. Perl::Critic and stricturesby FalseVinylShrub (Chaplain)
|on Jun 22, 2010 at 05:45 UTC||Need Help??|
FalseVinylShrub has asked for the
wisdom of the Perl Monks concerning the following question:
I've recently been trying to catch up and improve my Perl skills. That includes trying to get my code to pass perlcritic (with suitable configuration) and trying to use Dist::Zilla to automate builds. However I keep running into a problem:
PkgVersion adds a line setting $VERSION after each package line, saving the bother of updating these by hand and the probable inconsistencies caused by that.
However, Perl::Critic::(...)::RequireUseStrict will complain about the version setting code coming before use strict; in the module. (same applies for ...::RequireUseWarnings)
If I move use strict; use warnings; before the package statement, Perl::Critic::(...)::RequireExplicitPackage complains that I have code outside of an explicit package.
I would like to keep both of these policies to tell me about mistakes. However in this case the violations seem harmless, right?
I am also wondering, is there a reason to prefer one of
Is one more helpful than the other?
My current thinking is that it will be best to modify Dist::Zilla::Plugin::PkgVersion to put the version number after strictures. However, this might be quite hard. So before I start, has anyone else solved this or got a suggestion for a better solution?
Disclaimer: Please review and test code, and use at your own risk... If I answer a question, I would like to hear if and how you solved your problem.