Perl::...ithOne(3pm)

πŸ’… NAME πŸ’…

Okay bestie, so this is Perl::Critic::Policy::Modules::RequireEndWithOne β€” part of the Perl::Critic fam, coming at you from the 3pm section of the manual (User Contributed Perl Documentation, no cap). And what does it do? It says: end each module with an explicitly 1; instead of some funky expression. Periodt. πŸŽ€


✨ AFFILIATION ✨

This Policy is part of the core Perl::Critic distribution. So like, it's already in the group chat. You don't gotta go find it. 🫢


🌸 DESCRIPTION 🌸

So here's the vibe check: all files included via use or require must end with a true value, right? Because that's how the caller knows the include actually worked β€” like a little "yup, we're good, it loaded" text back. πŸ’¬

Standard practice? Conclude your .pm files with 1;. Simple, iconic, done.

But some authors like to get clever 🀨 and return some other true value, like:

return "Club sandwich";

And honestly? We cannot tolerate such frivolity! 😭 OK fine, we can, but we don't recommend it, because it confuses the newcomers. Fr fr. Keep it boring, keep it 1;. πŸ‘‘


πŸ¦‹ CONFIGURATION πŸ¦‹

This Policy is not configurable except for the standard options. That's it. That's the whole section. No extra knobs, no secret settings, nothing to tweak. πŸŽ€


πŸ’œ AUTHOR πŸ’œ

Chris Dolan cdolan@cpan.org 🌈

Some portions cribbed from Perl::Critic::Policy::Modules::RequireExplicitPackage. Credit where credit's due, iykyk. πŸ’…


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


Lowkey the most important part: that trailing 1; is the moment, the main character energy of your .pm file. Don't leave it hanging with a weird expression. 😀

And that's the tea, bestie β€” page brought to you by perl v5.42.0, dated 2024-10-23. Now go end your modules with 1; and slay. πŸ’–βœ¨

πŸ“¦ where this page comes from