http://www.perlmonks.org?node_id=596812


in reply to Re^3: Module Announcement: Perl-Critic-1.01
in thread Module Announcement: Perl-Critic-1.01

Dead on the mark, BrowserUk, and the link you provided is very appropriate:
"I must admit the lady wasn't too persistent and I realised she was only doing what she's been told to do."

A Morrisons spokesman said: "This is done with the best of intentions and we would hope it is taken in good humour by those obviously over the age of 21, as we do not wish to cause offence and no disrespect is intended.

"We take our responsibility with regard to selling alcohol very seriously and all our stores operate the Task 21 scheme, which addresses the difficulties staff face in being able to determine if a customer is legally old enough to buy alcohol.

"To further limit any element of doubt, staff at the Acomb store are required to ask anyone buying alcohol to confirm that they are over 21."

Continue to force people to do things contrary to their understanding of what is best in a given context, only because there are rules that say so, and you end up with them not being able to trust their inner guidance any more.

Perl is so much about context and expression, which comes along with ambiguities, that rule enforcing ultimately leads you to fighting your tool.

If by some odd chance I have to live under the sway of Perl::Critic (or PBP, for that matter), I'll continue to say mkdir $dir, 0755 and not convert the flags to decimal, and I'll say opendir (D, $dir) or die "foo: $!\n" despite grouping parens for builtins being deprecated, because that way I can work best, fast, and I can read my code. Any other perler also can; the aforementioned expressions will only seem wrong to those which know PBP and don't know TIMTOWDI.

I'll continue to use perl "to get your job done, before your boss fires you" (which you sometimes is me, sometimes is you). I guess I will have gob enough to argue with any PHB, and the code fixing a la Damian will be paid for, as well...

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^5: Module Announcement: Perl-Critic-1.01
by pKai (Priest) on Jan 27, 2007 at 10:54 UTC
Re^5: Module Announcement: Perl-Critic-1.01
by chargrill (Parson) on Jan 30, 2007 at 00:48 UTC

    FYI, a starting point for an appropriate ~/.perlcriticrc for you (based on the above) might look like:

    [-CodeLayout::ProhibitParensWithBuiltins] [-ValuesAndExpressions::ProhibitLeadingZeros] [-InputOutput::ProhibitTwoArgOpen] #if applicable to opendir

    I wouldn't disparage the tool because it recommends things you don't agree with. I think even TheDamian suggests that not everyone will agree with every "Best Practice", as any thread concerning PBP here will clearly show. However, enough can not be said for something that helps a team of developers write all code in a consistent manner, a manner that tends toward readability, maintainability, and as few bugs due to misunderstandings as possible.

    For posterity, my ~/.perlcriticrc file looks like this:

    [-RegularExpressions::RequireExtendedFormatting] [-RegularExpressions::RequireLineBoundaryMatching] [-Miscellanea::RequireRcsKeywords] [-Modules::RequireVersionVar] [ControlStructures::ProhibitPostfixControls] allow = if severity = 1

    Keep in mind that Perl::Critic is highly configurable, and will only alert you to "issues" at its current reporting level - which is quite low (when using the command line tool without any options).



    --chargrill
    s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)