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.017
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 die_on_existing_version
41 If true, then when PkgVersion sees an existing $VERSION assignment, it
42 will throw an exception rather than skip the file. This attribute
43 defaults to false.
44
45 die_on_line_insertion
46 By default, PkgVersion looks for a blank line after each "package"
47 statement. If it finds one, it inserts the $VERSION assignment on that
48 line. If it doesn't, it will insert a new line, which means the
49 shipped copy of the module will have different line numbers (off by
50 one) than the source. If "die_on_line_insertion" is true, PkgVersion
51 will raise an exception rather than insert a new line.
52
53 use_package
54 This option, if true, will not insert an assignment to $VERSION but
55 will replace the existing "package" declaration with one that includes
56 a version like:
57
58 package Module::Name 0.001;
59
60 use_our
61 The idea here was to insert "{ our $VERSION = '0.001'; }" instead of
62 "$Module::Name::VERSION = '0.001';". It turns out that this causes
63 problems with some analyzers. Use of this feature is deprecated.
64
65 Something else will replace it in the future.
66
67 use_begin
68 If true, the version assignment is wrapped in a BEGIN block. This may
69 help in rare cases, such as when DynaLoader has to be called at BEGIN
70 time, and requires VERSION. This option should be needed rarely.
71
72 Also note that assigning to $VERSION before the module has finished
73 compiling can lead to confused behavior with attempts to determine
74 whether a module was successfully loaded on perl v5.8.
75
76 finder
77 This is the name of a FileFinder for finding modules to edit. The
78 default value is ":InstallModules" and ":ExecFiles"; this option can be
79 used more than once.
80
81 Other predefined finders are listed in "default_finders" in
82 Dist::Zilla::Role::FileFinderUser. You can define your own with the
83 [FileFinder::ByName] and [FileFinder::Filter] plugins.
84
86 Core Dist::Zilla plugins: PodVersion, AutoVersion, NextRelease.
87
88 Other Dist::Zilla plugins: OurPkgVersion inserts version numbers using
89 "our $VERSION = '...';" and without changing line numbers
90
92 Ricardo SIGNES 😏 <rjbs@cpan.org>
93
95 This software is copyright (c) 2020 by Ricardo SIGNES.
96
97 This is free software; you can redistribute it and/or modify it under
98 the same terms as the Perl 5 programming language system itself.
99
100
101
102perl v5.32.0 2020-11-03Dist::Zilla::Plugin::PkgVersion(3)