NAME

SYNOPSIS

use Perl::Version::Bumper::Helper::Version ':all';

my $v;

# all the following return '5.036'
$v = version_fmt(5.036001);        # number
$v = version_fmt('v5.036.001');    # string
$v = version_fmt(v5.36.1);         # v-string

# format for `use VERSION`
$v = version_use('5.036002');      # v5.36

# nearest stable version below
$v = stable_version("v5.37.8");    # 5.036

# decrement to the previous stable version
$v = stable_version_inc("v5.37.8");    # 5.036

# increment to the next stable version
$v = stable_version_inc("v5.37.8");    # 5.038

DESCRIPTION

This module provides a collection of helper functions used by Perl::Version::Bumper to manipulate version numbers.

Be aware that they are mostly meant for internal use of the module and helper scripts, and are not meant for general usage.

FUNCTIONS

The following functions can be optionally exported. The :all export tag will export them all at once.

version_fmt

my $v = version_fmt( $version );

Return the given version (in string, v-string or float format) as a number.

This function will die if the given version is not a plausible Perl version number, i.e. is strictly lower than 5.010.

Note that all the following functions start by normalizing their argument by calling "version_fmt", meaning they will die in the same circumstances.

version_use

my $v = version_use( $version );

Return the given version (in string, v-string or float format) as a string suitable for a use VERSION line.

stable_version

my $s = stable_version( $version );

Return the closest stable version lower or equal to the given version, as a number.

stable_version_inc

my $n = stable_version_inc( $version );

Return the stable version following the given version, as a number.

stable_version_dec

my $p = stable_version_dec( $version );

Return the stable version preceding the given version, as a number.

AUTHOR

Philippe Bruhat (BooK) <book@cpan.org>

COPYRIGHT

Copyright 2024-2026 Philippe Bruhat (BooK), all rights reserved.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.