Perl::Critic::Policy::Community::PackageMatchesFilename - Module files should declare a package matching the filename
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.
require
use
no
import
## 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.
This policy is part of Perl::Critic::Community.
This policy is not configurable except for the standard options.
Dan Book, dbook@cpan.org
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.
Perl::Critic
To install Perl::Critic::Community, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl::Critic::Community
CPAN shell
perl -MCPAN -e shell install Perl::Critic::Community
For more information on module installation, please visit the detailed CPAN module installation guide.