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::Variables::RequireInitializationFoUseraContributed PerlPerl::Critic::Policy::Variables::RequireInitializationForLocalVars(3)

NAME
Perl::Critic::Policy::Variables::RequireInitializationForLocalVars - Write "local $foo = $bar;" instead of just "local $foo;". AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
Most people don't realize that a localized copy of a variable does not retain its original value. Unless you initialize the variable when you "local"-ize it, it defaults to "undef". If you want the variable to retain its original value, just initialize it to itself. If you really do want the localized copy to be undef, then make it explicit. package Foo; $Bar = '42'; package Baz; sub frobulate { local $Foo::Bar; #not ok, local $Foo::Bar is 'undef' local $Foo::Bar = undef; #ok, local $Foo::Bar is obviously 'undef' local $Foo::Bar = $Foo::Bar; #ok, local $Foo::Bar still equals '42' } CONFIGURATION
This Policy is not configurable except for the standard options. AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> COPYRIGHT
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved. 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.16.3 2014-06-0Perl::Critic::Policy::Variables::RequireInitializationForLocalVars(3)
Man Page

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl : I \ O

Hello Forum, first thanks indvance. I am trying to read a text file then write it to another file. I am getting these errors: Global symbol "$line" requires explicit package name at ./trans_pak.pl line 29. Global symbol "$line" requires explicit package name at ./trans_pak.pl line 31.... (7 Replies)
Discussion started by: rawmaterial
7 Replies

2. Shell Programming and Scripting

Perl variable declaration

what is the meaning of this particular line of code in perl. my %global_port2lanid = (); (2 Replies)
Discussion started by: suvenduperl
2 Replies

3. Hardware

Name These Little Nuts for my Server Cabinet?

I bought a server cabinet recently and the person who sold it to me included some strange nuts. Can anyone tell me what they are called? I need to buy more. Below is the image of them. Thank you! http://s23.postimg.org/50fx2ge6j/image.jpg http://s23.postimg.org/o498isr0r/image.jpg ... (1 Reply)
Discussion started by: danijeljames
1 Replies