1Perl::Critic::Policy::MUPosederurll:eC:soC:nr:tiRrteiiqbcuu:it:rePedoElxPipeclryil:c:iDMtooPcdauucmlkeeansgt:ea:(tR3ie)oqnuireExplicitPackage(3)
2
3
4

NAME

6       Perl::Critic::Policy::Modules::RequireExplicitPackage - Always make the
7       "package" explicit.
8

AFFILIATION

10       This Policy is part of the core Perl::Critic distribution.
11

DESCRIPTION

13       In general, the first statement of any Perl module or library should be
14       a "package" statement.  Otherwise, all the code that comes before the
15       "package" statement is getting executed in the caller's package, and
16       you have no idea who that is.  Good encapsulation and common decency
17       require your module to keep its innards to itself.
18
19       There are some valid reasons for not having a "package" statement at
20       all.  But make sure you understand them before assuming that you should
21       do it too.
22
23       The maximum number of violations per document for this policy defaults
24       to 1.
25

CONFIGURATION

27       As for programs, most people understand that the default package is
28       "main", so this Policy doesn't apply to files that begin with a perl
29       shebang.  If you want to require an explicit "package" declaration in
30       all files, including programs, then add the following to your
31       .perlcriticrc file
32
33           [Modules::RequireExplicitPackage]
34           exempt_scripts = 0
35

IMPORTANT CHANGES

37       This policy was formerly called "ProhibitUnpackagedCode" which sounded
38       a bit odd.  If you get lots of "Cannot load policy module" errors, then
39       you probably need to change "ProhibitUnpackagedCode" to
40       "RequireExplicitPackage" in your .perlcriticrc file.
41

AUTHOR

43       Jeffrey Ryan Thalhammer <thaljef@cpan.org>
44
46       Copyright (c) 2005-2009 Jeffrey Ryan Thalhammer.  All rights reserved.
47
48       This program is free software; you can redistribute it and/or modify it
49       under the same terms as Perl itself.  The full text of this license can
50       be found in the LICENSE file included with this module.
51
52
53
54perl v5.12.1          Perl::Critic2:0:1P0o-l0i9c-y0:8:Modules::RequireExplicitPackage(3)
Impressum