FalseVinylShrub has asked for the wisdom of the Perl Monks concerning the following question:
Hi
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
use strict; use warnings; package Foo; ...
versus
package Foo; use strict; use warnings; ...
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?
Thanks
FalseVinylShrub
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Dist::Zilla::Plugin::PkgVersion vs. Perl::Critic and strictures
by rjbs (Pilgrim) on Jun 22, 2010 at 12:04 UTC | |
by FalseVinylShrub (Chaplain) on Jun 22, 2010 at 12:26 UTC | |
Re: Dist::Zilla::Plugin::PkgVersion vs. Perl::Critic and strictures
by Herkum (Parson) on Jun 22, 2010 at 14:42 UTC | |
by FalseVinylShrub (Chaplain) on Jun 22, 2010 at 16:07 UTC | |
Re: Dist::Zilla::Plugin::PkgVersion vs. Perl::Critic and strictures
by emazep (Priest) on Jan 21, 2011 at 11:28 UTC | |
Re: Dist::Zilla::Plugin::PkgVersion vs. Perl::Critic and strictures
by voj (Acolyte) on Oct 21, 2013 at 12:40 UTC |