Perl::...lockMap(3pm)

✨ NAME ✨

okay bestie, welcome to the <pink>Perl::...lockMap(3pm)</pink> page from the <purple>User Contributed Perl Documentation</purple>! πŸ’… The policy here is Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap β€” it wants you to write map { /$pattern/ } @list instead of map /$pattern/, @list. That's the whole vibe. ✨

🌸 AFFILIATION 🌸

This Policy is part of the core Perl::Critic distribution. No cap, it ships with the core crew. 🫢

πŸ¦‹ DESCRIPTION πŸ¦‹

The expression forms of grep and map are awkward and hard to read β€” they're lowkey giving "trying to decode a text from your ex" energy. 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

πŸŽ€ CONFIGURATION πŸŽ€

This Policy is not configurable except for the standard options. That's it, bestie β€” no extra settings to hunt for. πŸŽ€

πŸ”₯ SEE ALSO πŸ”₯

  • Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval
  • Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep

πŸ‘‘ AUTHOR πŸ‘‘

Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> β€” iconic author behavior. πŸ‘‘

Copyright (c) 2005-2013 Imaginative Software Systems. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module.


k bye bestie! πŸ’‹ this little page is from <pink>perl v5.42.0</pink>, dated <purple>2024-10-23</purple>, and it's the <rainbow>Perl::...lockMap(3pm)</rainbow> manual β€” slay and goodbye! 🌈

πŸ“¦ where this page comes from