NAME
Versioning::Scheme::Monotonic - Monotonic versioning
VERSION
This document describes version 0.004 of Versioning::Scheme::Monotonic (from Perl distribution Versioning-Scheme), released on 2018-10-11.
SYNOPSIS
use Versioning::Scheme::Monotonic;
# checking validity
Versioning::Scheme::Monotonic->is_valid('1.2'); # 1
Versioning::Scheme::Monotonic->is_valid('1.02'); # 0
Versioning::Scheme::Monotonic->is_valid('1.2.0'); # 1
Versioning::Scheme::Monotonic->is_valid('1.2.1'); # 0
# normalizing
Versioning::Scheme::Monotonic->normalize('1.2.0'); # => '1.2'
# comparing
Versioning::Scheme::Monotonic->compare('1.2', '1.2.0'); # 0
Versioning::Scheme::Monotonic->compare('1.2', '1.13'); # -1
Versioning::Scheme::Monotonic->compare('2.2', '1.13'); # 1
# bumping
Versioning::Scheme::Monotonic->bump('1.2'); # => '1.3'
Versioning::Scheme::Monotonic->bump('1.2', {num=>2}); # => '1.4'
Versioning::Scheme::Monotonic->bump('1.2', {part=>0}); # => '2.3'
Versioning::Scheme::Monotonic->bump('1.2', {num=>-1, part=>0}); # => '0.1'
You can also mix this role into your class.
DESCRIPTION
This class implements the monotonic versioning scheme as described in [1]. A version number comprises two whole numbers:
COMPATIBILITY.RELEASE
where COMPATIBILITY starts at 0 and RELEASE starts at 1 with no zero prefix. An additional ".0" is allowed for compatibility with semantic versioning:
COMPATIBILITY.RELEASE.0
RELEASE is always increased. COMPATIBILITY is increased whenever there's a backward-incompatibility introduced.
Normalizing just normalized COMPATIBILITY.RELEASE.0 into COMPATIBILITY.RELEASE.
Comparing is performed using this expression:
(COMPATIBILITY1 <=> COMPATIBILITY2) || (RELEASE1 <=> RELEASE2)
Bumping by default increases RELEASE by 1. You can specify option num
(e.g. 2) to bump RELEASE by that number. You can specify option part
(e.g. 0) to increase COMPATIBILITY instead; but in that case RELEASE will still be bumped by 1.
METHODS
is_valid_version
normalize_version
cmp_version
bump_version
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/Versioning-Scheme.
SOURCE
Source repository is at https://github.com/perlancar/perl-Versioning-Scheme.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Versioning-Scheme
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
SEE ALSO
[1] http://blog.appliedcompscilab.com/monotonic_versioning_manifesto/
Version::Monotonic, an older incantation of this module.
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2018 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.