1Perl::Critic::Policy::MUosdeurleCPsoe:nr:tlRr:ei:qbCuuritiretediVceP:re:srPiloolnDiVocacyru:(m:3eM)notdautlieosn::RequireVersionVar(3)
2
3
4

NAME

6       Perl::Critic::Policy::Modules::RequireVersionVar - Give every module a
7       $VERSION number.
8

AFFILIATION

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

DESCRIPTION

13       Every Perl file (modules, libraries, and programs) should have a
14       $VERSION variable.  The $VERSION allows clients to insist on a
15       particular revision of your file like this:
16
17           use SomeModule 2.4;  #Only loads version 2.4
18
19       This Policy scans your file for any package variable named $VERSION.
20       I'm assuming that you are using "strict", so you'll have to declare it
21       like one of these:
22
23           our $VERSION = 1.0611;
24           $MyPackage::VERSION = 1.061;
25           use vars qw($VERSION);
26           use version; our $VERSION = qv(1.0611);
27
28       A common practice is to use the "$Revision: 3629 $" keyword to
29       automatically define the $VERSION variable like this:
30
31           our ($VERSION) = '$Revision: 3629 $' =~ m{ \$Revision: \s+ (\S+) }x;
32

CONFIGURATION

34       This Policy is not configurable except for the standard options.
35

NOTES

37       Conway recommends using the "version" pragma instead of raw numbers or
38       'v-strings.'  However, this Policy only insists that the $VERSION be
39       defined somehow.  I may try to extend this in the future.
40

TO DO

42       Add check that $VERSION is independently evaluatable.  In particular,
43       prohibit this:
44
45           our $VERSION = $Other::Module::VERSION;
46
47       This doesn't work because PAUSE and other tools literally copy your
48       version declaration out of your module and evaluates it in isolation,
49       at which point there's nothing in "Other::Module", and so the $VERSION
50       is undefined.
51

AUTHOR

53       Jeffrey Ryan Thalhammer <thaljef@cpan.org>
54
56       Copyright (c) 2005-2009 Jeffrey Ryan Thalhammer.  All rights reserved.
57
58       This program is free software; you can redistribute it and/or modify it
59       under the same terms as Perl itself.  The full text of this license can
60       be found in the LICENSE file included with this module.
61
62
63
64perl v5.10.1               Perl::C2r0i1t0i-c1:1:-P1o2licy::Modules::RequireVersionVar(3)
Impressum