Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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.


In reply to Dist::Zilla::Plugin::PkgVersion vs. Perl::Critic and strictures by FalseVinylShrub

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-16 16:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found