Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

perl::critic::policy::modules::requirefilenamematchespackage(3pm) [debian man page]

Perl::Critic::Policy::Modules::RequireFilenameMatchesPacUser(Contributed Perl DocPerl::Critic::Policy::Modules::RequireFilenameMatchesPackage(3pm)

NAME
Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage - Package declaration must match filename. AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
The package declaration should always match the name of the file that contains it. For example, "package Foo::Bar;" should be in a file called "Bar.pm". This makes it easier for developers to figure out which file a symbol comes from when they see it in your code. For instance, when you see "Foo::Bar->new()", you should be able to find the class definition for a "Foo::Bar" in a file called Bar.pm Therefore, this Policy requires the last component of the first package name declared in the file to match the physical filename. Or if "#line" directives are used, then it must match the logical filename defined by the prevailing "#line" directive at the point of the package declaration. Here are some examples: # Any of the following in file "Foo/Bar/Baz.pm": package Foo::Bar::Baz; # ok package Baz; # ok package Nuts; # not ok (doesn't match physical filename) # using #line directives in file "Foo/Bar/Baz.pm": #line 1 Nuts.pm package Nuts; # ok package Baz; # not ok (contradicts #line directive) If the file is not deemed to be a module, then this Policy does not apply. Also, if the first package namespace found in the file is "main" then this Policy does not apply. CONFIGURATION
This Policy is not configurable except for the standard options. AUTHOR
Chris Dolan <cdolan@cpan.org> COPYRIGHT
Copyright (c) 2006-2011 Chris Dolan. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-06-07 Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage(3pm)

Check Out this Related Man Page

Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversaUser(Contributed Perl DocPerl::Critic::Policy::BuiltinFunctions::ProhibitUniversalCan(3pm)

NAME
Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalCan - Write "eval { $foo->can($name) }" instead of "UNIVERSAL::can($foo, $name)". AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
print UNIVERSAL::can($obj, 'Foo::Bar') ? 'yes' : 'no'; #not ok print eval { $obj->can('Foo::Bar') } ? 'yes' : 'no'; #ok As of Perl 5.9.3, the use of UNIVERSAL::can as a function has been deprecated and the method form is preferred instead. Formerly, the functional form was recommended because it gave valid results even when the object was "undef" or an unblessed scalar. However, the functional form makes it impossible for packages to override "can()", a technique which is crucial for implementing mock objects and some facades. See UNIVERSAL::can for a more thorough discussion of this topic. CONFIGURATION
This Policy is not configurable except for the standard options. SEE ALSO
Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalIsa AUTHOR
Chris Dolan <cdolan@cpan.org> COPYRIGHT
Copyright (c) 2006-2011 Chris Dolan. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. perl v5.14.2 2012-06-07 Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalCan(3pm)
Man Page