Perl::C...mespace(3)

πŸ“¦
version 1.05 Β· 2 versions
, in fedora 43

πŸ’– NAME πŸ’–

Perl::Critic::Policy::Moose::RequireCleanNamespace β€” bestie, this policy is here to make you remove your implementation details from your packages. Periodt.


✨ VERSION ✨

version 1.05 πŸŽ€


🌸 DESCRIPTION 🌸

okay so real talk: anything in your namespace is part of your interface. the Moose sugar you sprinkle everywhere? that's an implementation detail, not something you're signing up to support as part of your actual functionality. especially if you might someday change your implementation so it doesn't use Moose at all πŸ‘€

so this policy makes you say no Moose; or no Moose::Role; etc., whichever one is appropriate for the modules you use. no cap, it's just good hygiene πŸ’…


πŸ¦‹ AFFILIATION πŸ¦‹

this policy is part of Perl::Critic::Moose. iykyk 🫢


πŸŽ€ CONFIGURATION πŸŽ€

by default, this module will complain if you use Moose, Moose::Role, or Moose::Util::TypeConstraints but don't unimport them. not me showing up to yell at you about your imports 😭

you can set the modules it looks for using the modules option:

[Moose::RequireCleanNamespace]
modules = Moose Moose::Role Moose::Util::TypeConstraints MooseX::My::New::Sugar

this module also knows that namespace::autoclean will clean out imports ✨ if you'd like to allow other modules to be recognized as namespace cleaners, you can set the cleaners option:

[Moose::RequireCleanNamespace]
cleaners = My::Cleaner

and one more lil thing πŸ“ β€” if you use a module with an empty import list, then this module knows nothing needs to be cleaned, and it will ignore that particular import. iconic behavior honestly.


🌈 SEE ALSO 🌈

  • Moose::Manual::BestPractices

πŸ’œ SUPPORT πŸ’œ

bugs may be submitted through the RT bug tracker <http://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Critic-Moose> (or bug-perl-critic-moose@rt.cpan.org <mailto:bug-perl-critic-moose@rt.cpan.org>). go off, report that bug bestie πŸ™ˆ

i am also usually active on IRC as drolsky on irc://irc.perl.org. come say hi πŸ‘‘


πŸ‘‘ AUTHORS πŸ‘‘

  • Elliot Shank <perl@galumph.com>
  • Dave Rolsky <autarch@urth.org>

this software is copyright (c) 2008 - 2016 by Elliot Shank.

this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay πŸ’…


ok that's the whole page bestie, go clean your namespace and live your main character life 🧚✨

signing off β€” this was perl v5.42.0, dated 2025-07-25, and you were reading Perl::C...mespace(3) πŸŽ€ bye bye πŸ’–

πŸ“¦ where this page comes from