Perl::...ilename(3pm)

πŸ“¦
version 1.0.4 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

omg bestie, you found the Perl::...ilename(3pm) page from User Contributed Perl Documentation! πŸ’–

✨ NAME ✨

Perl::Critic::Policy::Community::PackageMatchesFilename β€” module files should declare a package matching the filename. periodt. πŸ’…


πŸ’… DESCRIPTION πŸ’…

okay so here's the tea, bestie. Perl modules are normally loaded by require (possibly via use or no). When you give require a module name, it will translate that into a filename and then load whatever that file contains. The file doesn't need to actually contain a package matching the module name initially given to require, but this can be confusing if later operations (including import as called by use) expect the package to exist. Furthermore, the absence of such a package is usually an indicator of a typo in the package name. lowkey iconic warning, fr fr. 🫢

Like, for example:

## in file My/Module.pm
package My::Module;

This policy is similar to the core policy Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage, but only requires that one package name within a module file matches the filename. so it's a little more chill, but still slay. πŸ¦‹


🌸 AFFILIATION 🌸

This policy is part of Perl::Critic::Community. πŸ’œ


πŸŽ€ CONFIGURATION πŸŽ€

This policy is not configurable except for the standard options. no extra knobs, bestie, it's giving simplicity. ✨


πŸ‘‘ AUTHOR πŸ‘‘

Dan Book, dbook@cpan.org πŸ’Œ


Copyright 2015, Dan Book.

This library is free software; you may redistribute it and/or modify it under the terms of the Artistic License version 2.0. πŸŽ€


πŸ”₯ SEE ALSO πŸ”₯

Perl::Critic πŸ‘‘


mwah! this was perl v5.40.1, dated 2025-03-22, for Perl::...ilename(3pm) β€” bye bestie, go slay those package names πŸ’–βœ¨

πŸ“¦ where this page comes from