Perl::...yQuotes(3pm)

✨ NAME ✨

okay so this is Perl::...yQuotes(3pm) β€” a user-contributed Perl doc page, and the actual policy main character is Perl::Critic::Policy::ValuesAndExpressions::ProhibitEmptyQuotes. The whole vibe? Write q{} instead of ''. Periodt. πŸ’…

πŸŽ€ AFFILIATION πŸŽ€

This Policy is part of the core Perl::Critic distribution. So it’s not some random side quest β€” it ships with the core crew. 🫢

πŸ¦‹ DESCRIPTION πŸ¦‹

Bestie, do not use quotes for an empty string or any string that is pure whitespace. Instead, use q{} to improve legibility. Even better? Make named values like this. And use the x operator to repeat characters. Obsessed with how clean that is.

           $message = '';      #not ok
           $message = "";      #not ok
           $message = "     "; #not ok

           $message = q{};     #better
           $message = q{     } #better

           $EMPTY = q{};
           $message = $EMPTY;      #best

           $SPACE = q{ };
           $message = $SPACE x 5;  #best

The #not ok ones are literally not it; #better is the glow-up; #best is the final form. πŸ”₯

🌸 CONFIGURATION 🌸

No extra knobs here, bestie: this Policy is not configurable except for the standard options. fr fr. πŸ’–

🌈 SEE ALSO 🌈

Perl::Critic::Policy::ValuesAndExpressions::ProhibitNoisyStrings

πŸ‘‘ AUTHOR πŸ‘‘

Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>

Copyright (c) 2005-2011 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.


Sign-off time, bestie: this page is from perl v5.42.0, dated 2024-10-23 β€” mwah πŸ’‹πŸ«Ά

πŸ“¦ where this page comes from