Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Most of the default Perl::Critic policies come from TheDamian's Perl Best Practices. The rationale for the policies can be found in perlcritic's verbose output, the POD (in this case, Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap), and of course the book (page 169).

$ perlcritic 11119158.pl Expression form of "map" at line 8, column 12. See page 169 of PBP. +(Severity: 4) $ perlcritic --verbose 11 11119158.pl Expression form of "map" at line 8, near 'my @list = map "$_ beads", @ +colors, @grey_scale;'. BuiltinFunctions::RequireBlockMap (Severity: 4) The expression forms of `grep' and `map' are awkward and hard to r +ead. Use the block forms instead. @matches = grep /pattern/, @list; #not ok @matches = grep { /pattern/ } @list; #ok @mapped = map transform($_), @list; #not ok @mapped = map { transform($_) } @list; #ok

Although Perl::Critic policies usually have a very good reason, some of them can be seen as stylistic choices and one can disagree with PBP if one knows what one is doing. The severify of policies can be changed via the config file, e.g.:

$ cat ~/.perlcriticrc severity = 3 [BuiltinFunctions::RequireBlockMap] severity = 2

In reply to Re: Expression form of map or grep by haukex
in thread Expression form of map or grep by Lady_Aleena

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, 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, 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.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (2)
    As of 2020-10-24 05:23 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My favourite web site is:












      Results (242 votes). Check out past polls.

      Notices?