I was surprised it didn't like this use of eval:

our $VERSION = '0.1_1'; $VERSION = eval $VERSION;

As far as I remember, this is standard boilerplate introduced to ensure PAUSE will index the distribution with correct module versions. At one time, at least, PAUSE would scan the code for a version number in a fairly simplistic manner (specifically not running any code, for security concerns), so this ensured that it will see the string value as the version to index the code under while any actual code will see the eval'd value. I do not know if PAUSE still does that: I would expect by now that there would be ways to provide the version information more robustly by means of metadata.

For the rest of it: perlcritic by default is an implementation of PBP, and PBP was written with two goals in mind - for people who don't care, to provide a ready-made set of coding standards to use within an organization; for people who do care, to provide a starting point to think about how to assemble a set of coding standards.

Since Damian expected that organizations with the least Perl skills would be most likely to simply adopt PBP wholesale, the ready-made set is optimized for that group. The idea that every regexp should be written with //xms flags is an example of this: you can for example teach your developers that /./ means "match any character" without having to deal in complexities, and filling their head with edge cases. As kcott says, this is cargo-cult programming - but intentionally so.

The prescriptions in PBP were never intended to be a straitjacket for people who do care, and are prepared to put any time into thinking about how they want their code to look. I recommend reading it (or re-reading it) with that in mind before attempting to use them - even in second-hand form, as via perlcritic.


In reply to Re: How Critical is Critic? by hv
in thread How Critical is Critic? by Bod

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.