The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

VERSION

version 0.002

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 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.

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