Test::...espaces(3pm)

πŸ“¦
version 0.24 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– NAME πŸ’–

okay so bestie, meet Test::CleanNamespaces β€” it checks for uncleaned imports. that's the whole vibe. (also fun fact, the man page itself answers to Test::...espaces(3pm) up in the header, which is giving "my name got truncated in a text message" energy but whatever, we love her.) ✨


πŸŽ€ VERSION πŸŽ€

version 0.24 β€” she's on 0.24, no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

okay so this is literally how you use her:

use strict;
use warnings;
use Test::CleanNamespaces;

all_namespaces_clean;

that's it. that's the whole thing. iconic.


🌸 DESCRIPTION 🌸

so here's the tea β˜• β€” this module lets you check your module's namespaces for imported functions you might have forgotten to remove with namespace::autoclean or namespace::clean. and why do we care?? because those leftover imports are therefore available to be called as methods, which usually isn't what you want. like, bestie, that's not the moment. πŸ™ˆ


✨ FUNCTIONS ✨

good news: all functions are exported by default. no extra setup, she just shows up. periodt. πŸ’…

πŸ’œ namespaces_clean

namespaces_clean('YourModule', 'AnotherModule');

tests every specified namespace for uncleaned imports. and if the module couldn't be loaded? it just gets skipped. no drama, she moves on. 🫢

πŸ“ all_namespaces_clean

all_namespaces_clean;

runs namespaces_clean for all modules in your distribution. the full sweep. main character energy. πŸ‘‘

🧚 find_modules

my @modules = Test::CleanNamespaces->find_modules;

returns a list of modules in the current distribution. it'll search in blib/ if it exists β€” and lib/ will be searched otherwise. iykyk. πŸ¦‹

⭐ builder

my $builder = Test::CleanNamespaces->builder;

returns the Test::Builder used by the test functions. that's the one. πŸ’«


πŸ’€ KNOWN ISSUES πŸ’€

not me having to report this one 😭

uncleaned imports from Mouse classes are incompletely detected, due to its lack of ability to return the correct method list β€” it assumes that all subs are meant to be callable as methods unless they originated from (were imported by) one of: Mouse, Mouse::Role, Mouse::Util, Mouse::Util::TypeConstraints, Carp, Scalar::Util, or List::Util.

like, she's trying her best, fr fr. πŸ’…


🌈 SEE ALSO 🌈

the whole friend group, honestly. obsessed with all of them:

  • namespace::clean
  • namespace::autoclean
  • namespace::sweep
  • Sub::Exporter::ForMethods
  • Test::API
  • Sub::Name
  • Sub::Install
  • MooseX::MarkAsMethods
  • Dist::Zilla::Plugin::Test::CleanNamespaces

🫢 SUPPORT 🫢

got beef with a bug? bestie, take it to the RT bug tracker: <https://rt.cpan.org/Public/Dist/Display.html?Name=Test-CleanNamespaces> β€” or email <bug-Test-CleanNamespaces@rt.cpan.org> πŸ’Œ

there's also a mailing list available for users of this distribution, at <http://lists.perl.org/list/perl-qa.html>. very "join the group chat" of it. ✨

and there's also an irc channel available for users of this distribution, at "#perl" on irc.perl.org (<irc://irc.perl.org/#perl-qa>). come say hi, we don't bite. 🌸


πŸ‘‘ AUTHOR πŸ‘‘

Florian Ragwitz <rafl@debian.org> β€” the legend herself. πŸ’–


πŸ’… CONTRIBUTORS πŸ’…

  • Karen Etheridge <ether@cpan.org>
  • Graham Knop <haarg@haarg.org>

this software is copyright (c) 2009 by Florian Ragwitz. 🌈

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, honestly.


and that's a wrap, bestie πŸ’– this was Test::...espaces(3pm) from the perl v5.28.1 era, dated 2018-12-14, brought to you by User Contributed Perl Documentation. she's a little vintage, she's a little iconic, and she's still checking your namespaces. periodt. βœ¨πŸ¦‹
πŸ“¦ where this page comes from