logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Perl::Critic::Policy::Community::PackageMatchesFilename - Module files should declare a package matching

Affiliation

       This policy is part of Perl::Critic::Community.

Author

       Dan Book, "dbook@cpan.org"

Configuration

       This policy is not configurable except for the standard options.

Description

       Perl modules are normally loaded by "require" (possibly via "use" or "no").  When given a module name,
       "require" will translate this 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.

         ## 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.

Name

       Perl::Critic::Policy::Community::PackageMatchesFilename - Module files should declare a package matching
       the filename

See Also

       Perl::Critic

perl v5.40.1                                       2025-03-22              Perl::Critic::...MatchesFilename(3pm)

See Also