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

NAME

distversion - Query and modify Perl modules versions

SYNOPSIS

    perversion [ -config <file> ]  [ -listfiles ] [ -version <X.Y.Z> ] 
               [ -set <X.Y.Z> ] [ -increment <type> ]
               [ -verbose ]

DESCRIPTION

perversion is a tool to query and modify the version strings in files of a Perl module distribution. If you are not a module author, this is probably of no great use for you. If you are a module author, rejoice, your days of manual version updates are over!

Without options, perversion checks that all files given in the configuration files have the same version number.

OPTIONS

-short

If given, only output the found revision number without any frill. Useful for, e.g., when called from another script/program.

-config file

Use configuration file file. If not given, look for the file perversionrc in the current directory. For the format of the configuration file, see the section CONFIGURATION FILE below.

-version version

Check that all files are set to version.

-set version

Set all files to have the given version.

-increment [ major | minor | revision | alpha ]

Increment the version in all files by the given increment.

For example, if the current version is "1.2.3"

    -increment major    yields "2.0.0"
    -increment minor    yields "1.3.0"
    -increment revision yields "1.2.4"
    -increment alpha    yields "1.2_4"

CONFIGURATION FILE

perversion's configuration file is free-form Perl code, which last statement must be a hash. Its keys are the files containing the version strings, and the values are the regular expressions that catch them.

The regular expressions must capture the version string in $1.

More than one regular expression can be assigned to a file by using an array reference as the hash value. E.g.:

    $file{Foo.pm} = [ 
        qr/VERSION: (.*?)/, 
        qr/This is v(\S+)/, 
    ];

For example:

    use File::Find::Rule;

    my %file;

    $file{README} = qr/WWW-Ohloh-API version (\S+)/;

    for my $m ( File::Find::Rule->file->name( '*.pm' )->in( 'lib' ) ) {
        $file{$m} = [ 
            qr/\$VERSION\s*=\s*'(.*?)';/, 
            qr/This document describes \S+ version (\S*)/ 
        ];
    }

    %file;