1Dist::Zilla::Plugin::PkUgsVeerrsCioonnt(r3i)buted Perl DDoicsutm:e:nZtialtliao:n:Plugin::PkgVersion(3)
2
3
4
6 Dist::Zilla::Plugin::PkgVersion - add a $VERSION to your packages
7
9 version 6.031
10
12 in dist.ini
13
14 [PkgVersion]
15
17 This plugin will add lines like the following to each package in each
18 Perl module or program (more or less) within the distribution:
19
20 $MyModule::VERSION = '0.001';
21
22 or
23
24 { our $VERSION = '0.001'; }
25
26 ...where 0.001 is the version of the dist, and MyModule is the name of
27 the package being given a version. (In other words, it always uses
28 fully-qualified names to assign versions.)
29
30 It will skip any package declaration that includes a newline between
31 the "package" keyword and the package name, like:
32
33 package
34 Foo::Bar;
35
36 This sort of declaration is also ignored by the CPAN toolchain, and is
37 typically used when doing monkey patching or other tricky things.
38
40 This module should work on any version of perl still receiving updates
41 from the Perl 5 Porters. This means it should work on any version of
42 perl released in the last two to three years. (That is, if the most
43 recently released version is v5.40, then this module should work on
44 both v5.40 and v5.38.)
45
46 Although it may work on older versions of perl, no guarantee is made
47 that the minimum required version will not be increased. The version
48 may be increased for any reason, and there is no promise that patches
49 will be accepted to lower the minimum required perl.
50
52 die_on_existing_version
53 If true, then when PkgVersion sees an existing $VERSION assignment, it
54 will throw an exception rather than skip the file. This attribute
55 defaults to false.
56
57 die_on_line_insertion
58 By default, PkgVersion looks for a blank line after each "package"
59 statement. If it finds one, it inserts the $VERSION assignment on that
60 line. If it doesn't, it will insert a new line, which means the
61 shipped copy of the module will have different line numbers (off by
62 one) than the source. If "die_on_line_insertion" is true, PkgVersion
63 will raise an exception rather than insert a new line.
64
65 use_package
66 This option, if true, will not insert an assignment to $VERSION but
67 will replace the existing "package" declaration with one that includes
68 a version like:
69
70 package Module::Name 0.001;
71
72 use_our
73 The idea here was to insert "{ our $VERSION = '0.001'; }" instead of
74 "$Module::Name::VERSION = '0.001';". It turns out that this causes
75 problems with some analyzers. Use of this feature is deprecated.
76
77 Something else will replace it in the future.
78
79 use_begin
80 If true, the version assignment is wrapped in a BEGIN block. This may
81 help in rare cases, such as when DynaLoader has to be called at BEGIN
82 time, and requires VERSION. This option should be needed rarely.
83
84 Also note that assigning to $VERSION before the module has finished
85 compiling can lead to confused behavior with attempts to determine
86 whether a module was successfully loaded on perl v5.8.
87
88 finder
89 This is the name of a FileFinder for finding modules to edit. The
90 default value is ":InstallModules" and ":ExecFiles"; this option can be
91 used more than once.
92
93 Other predefined finders are listed in "default_finders" in
94 Dist::Zilla::Role::FileFinderUser. You can define your own with the
95 [FileFinder::ByName] and [FileFinder::Filter] plugins.
96
98 Core Dist::Zilla plugins: PodVersion, AutoVersion, NextRelease.
99
100 Other Dist::Zilla plugins: OurPkgVersion inserts version numbers using
101 "our $VERSION = '...';" and without changing line numbers
102
104 Ricardo SIGNES 😏 <cpan@semiotic.systems>
105
107 This software is copyright (c) 2023 by Ricardo SIGNES.
108
109 This is free software; you can redistribute it and/or modify it under
110 the same terms as the Perl 5 programming language system itself.
111
112
113
114perl v5.36.1 2023-11-21Dist::Zilla::Plugin::PkgVersion(3)