Perl::...gCommas(3pm)
π NAME π
Okay bestie, welcome to the Perl::...gCommas(3pm) page from User Contributed Perl Documentation. The policy itself is Perl::Critic::Policy::CodeLayout::RequireTrailingCommas β put a comma at the end of every multi-line list declaration, including the last one. Periodt. π
π¦ AFFILIATION π¦
This Policy is part of the core Perl::Critic distribution. It's giving official, no cap. β¨
πΈ DESCRIPTION πΈ
Conway (yes, that Conway) suggests that all elements in a multi-line list should be separated by commas, including the last element. Why? Because it makes re-ordering the list by cutting and pasting a little easier. Lowkey genius. π
Here's the vibe check β this one is not ok:
my @list = ($foo,
$bar,
$baz); #not ok
And this one? ok, slay:
my @list = ($foo,
$bar,
$baz,); #ok
π CONFIGURATION π
This Policy is not configurable except for the standard options. That's the whole config story. π
π NOTES π
In the PPI parlance, a "list" is almost anything with parentheses. I've tried to make this Policy smart by targeting only "lists" that have at least one element and are being assigned to something. However, there may be some edge cases that I haven't covered. If you find one, send me a note. Fr fr. π«Ά
π AUTHOR π
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
π COPYRIGHT π
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.
That's the whole page, bestie! π This is from perl v5.42.0, dated 2024-10-23, and it's the Perl::...gCommas(3pm) page β go forth and comma-slay. ππ
π¦ where this page comes from
- opensuse-leap 16.0: perl-Perl-Critic 1.156.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms