Perl::...wlines(3pm)

πŸ’– NAME πŸ’–

okay bestie, welcome to the Perl::...wlines(3pm) page β€” this is User Contributed Perl Documentation, and we’re folding the manual name in right here instead of copy-pasting the header line, because we’re cute like that 🫢. The policy is Perl::Critic::Policy::ValuesAndExpressions::ProhibitImplicitNewlines: use concatenation or HEREDOCs instead of literal line breaks in strings. No cap.

🌈 AFFILIATION 🌈

This Policy is literally part of the core Perl::Critic distribution. It’s in the main squad, not some side-quest module. πŸ’…

✨ DESCRIPTION ✨

Strings with embedded line breaks are hard to read β€” like, the vibe gets messy. Use concatenation or HEREDOCs instead. Here’s the glow-up:

my $foo = "Line one is quite long
Line two";                                    # Bad

my $foo = "Line one is quite long\nLine two"; # Better, but still hard to read

my $foo = "Line one is quite long\n"
    . "Line two";                               # Better still

my $foo = <<'EOF';                            # Use heredoc for longer passages
Line one is quite long
Line two
Line three breaks the camel's back
EOF

πŸŽ€ CONFIGURATION πŸŽ€

This Policy is not configurable except for the standard options. That’s the whole tea β˜• β€” no secret knobs, just the standard ones. Periodt.

πŸ’œ AUTHOR πŸ’œ

Chris Dolan <cdolan@cpan.org> β€” give him his flowers πŸ’.

🌸 CREDITS 🌸

Initial development of this policy was supported by a grant from the Perl Foundation. So iconic of them, honestly πŸ‘‘.

Copyright (c) 2007-2011 Chris Dolan. Many 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.

mwah πŸ’‹ β€” this page came from perl v5.42.0 and is dated 2024-10-23. Bye bestie πŸ¦‹

πŸ“¦ where this page comes from