++ed by:
ETHER KEEDI NGLENN KENTNL

4 PAUSE users

David Golden
and 2 contributors

NAME

Dist::Zilla::Plugin::RewriteVersion - Get and/or rewrite module versions to match distribution version

VERSION

version 0.009

SYNOPSIS

    # in your code, declare $VERSION like this:
    package Foo;
    our $VERSION = '1.23';

    # in your dist.ini
    [RewriteVersion]

DESCRIPTION

This module is both a VersionProvider and 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.

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.

ATTRIBUTES

global

If true, all occurrences of the version pattern will be replaced. Otherwise, only the first occurrence is replaced. Defaults to false.

skip_version_provider

If true, rely on some other mechanism for determining the "current" version instead of extracting it from the main_module. Defaults to false.

This enables hard-coding version = in dist.ini among other tricks.

SEE ALSO

AUTHOR

David Golden <dagolden@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2014 by David Golden.

This is free software, licensed under:

  The Apache License, Version 2.0, January 2004