Dist::Zilla::Plugin::RewriteVersion - Get and/or rewrite module versions to match distribution version
version 0.018
# in your code, declare $VERSION like this: package Foo; our $VERSION = '1.23'; # in your dist.ini [RewriteVersion]
This module is both a VersionProvider and FileMunger.
VersionProvider
FileMunger
This module finds a version in a specific format from the main module file and munges all gathered files to match. You can override the version found with the V environment variable, similar to Git::NextVersion, in which case all the gathered files have their $VERSION set to that value.
V
$VERSION
By default, versions must be "strict" -- decimal or 3+ part tuple with a leading "v". The allow_decimal_underscore option, if enabled, will also allow decimals to contain an underscore. All other version forms are not allowed, including: "v1.2", "1.2.3" and "v1.2.3_4".
allow_decimal_underscore
Only the first occurrence of a $VERSION declaration in each file is relevant and/or affected (unless the "global" attribute is set) and it must exactly match this regular expression:
qr{^our \s+ \$VERSION \s* = \s* '$version::LAX'}mx
It must be at the start of a line and any trailing comments are deleted. The original may have double-quotes, but the re-written line will have single quotes.
The very restrictive regular expression format is intentional to avoid the various ways finding a version assignment could go wrong and to avoid using PPI, which has similar complexity issues.
For most modules, this should work just fine.
See BumpVersionAfterRelease for more details and usage examples.
Allows use of decimal versions with underscores. Default is false. (Version tuples with underscores are never allowed!)
If true, all occurrences of the version pattern will be replaced. Otherwise, only the first occurrence is replaced. Defaults to false.
If true, rely on some other mechanism for determining the "current" version instead of extracting it from the main_module. Defaults to false.
main_module
This enables hard-coding version = in dist.ini among other tricks.
version =
dist.ini
If true, when the version is written, it will append a comment with the name of the tarball it comes from. This helps users track down the source of a module if its name doesn't match the tarball name. If the module is a TRIAL release, that is also in the comment. For example:
our $VERSION = '0.010'; # from Foo-Bar-0.010.tar.gz our $VERSION = '0.011'; # TRIAL from Foo-Bar-0.011-TRIAL.tar.gz
This option defaults to false.
Dist::Zilla::Plugin::RewriteVersion::Transitional
David Golden <dagolden@cpan.org>
This software is Copyright (c) 2014 by David Golden.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install Dist::Zilla::Plugin::BumpVersionAfterRelease, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dist::Zilla::Plugin::BumpVersionAfterRelease
CPAN shell
perl -MCPAN -e shell install Dist::Zilla::Plugin::BumpVersionAfterRelease
For more information on module installation, please visit the detailed CPAN module installation guide.