Versioning::Scheme::Dotted - Version as dotted numbers
This document describes version 0.007 of Versioning::Scheme::Dotted (from Perl distribution Versioning-Scheme), released on 2018-10-11.
use Versioning::Scheme::Dotted; # checking validity Versioning::Scheme::Dotted->is_valid_version('0.001.2.0'); # 1 Versioning::Scheme::Dotted->is_valid_version('v0.001.2.0'); # 0 Versioning::Scheme::Dotted->is_valid_version('1.2beta'); # 0 # parsing $parsed = Versioning::Scheme::Dotted->parse_version('1.2beta'); # => undef $parsed = Versioning::Scheme::Dotted->parse_version('1.2.3'); # => {parts=>[1, 2, 3]} # normalizing Versioning::Scheme::Dotted->normalize_version('0.001.2.0'); # => '0.001.2.0' Versioning::Scheme::Dotted->normalize_version('0.001.2.0', {parts=>3}); # => '0.001.2' Versioning::Scheme::Dotted->normalize_version('0.001.2.0', {parts=>5}); # => '0.001.2.0.0' # comparing Versioning::Scheme::Dotted->cmp_version('1.2.3', '1.2.3.0'); # 0 Versioning::Scheme::Dotted->cmp_version('1.2.3', '1.2.4'); # -1 Versioning::Scheme::Dotted->cmp_version('1.3.1', '1.2.4'); # 1 # bumping Versioning::Scheme::Dotted->bump_version('1.2.3'); # => '1.2.4' Versioning::Scheme::Dotted->bump_version('1.2.009'); # => '1.2.010' Versioning::Scheme::Dotted->bump_version('1.2.999'); # => '1.2.1000' Versioning::Scheme::Dotted->bump_version('1.2.3', {num=>2}); # => '1.2.5' Versioning::Scheme::Dotted->bump_version('1.2.3', {num=>-1}); # => '1.2.2' Versioning::Scheme::Dotted->bump_version('1.2.3', {part=>-2}); # => '1.3.0' Versioning::Scheme::Dotted->bump_version('1.2.3', {part=>0}); # => '2.0.0' Versioning::Scheme::Dotted->bump_version('1.2.3', {part=>-2, reset_smaller=>0}); # => '1.3.3'
You can also mix this role into your class.
This is a general scheme where a version is specified as a series of one or more non-negative integers separated by dots. Examples:
1 1.2 1.100.0394 3.4.5.6
This scheme is not the same as the Perl versioning scheme implemented by version, as the latter has some Perl-specific peculiarities.
Normalizing basically does nothing except checking the validity. But it can accept an option parts to specify number of parts.
parts
Comparing: Each part is compared numerically from the biggest (leftmost) part.
Bumping: By default the smallest (rightmost) part is increased by 1. You can specify options: num, part, reset_smaller like spacified in Role::Versioning::Scheme.
num
part
reset_smaller
Please visit the project's homepage at https://metacpan.org/release/Versioning-Scheme.
Source repository is at https://github.com/perlancar/perl-Versioning-Scheme.
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.
Versioning::Scheme, Role::Versioning::Scheme
Versioning::Scheme::Semantic
perlancar <perlancar@cpan.org>
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.
To install Versioning::Scheme, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Versioning::Scheme
CPAN shell
perl -MCPAN -e shell install Versioning::Scheme
For more information on module installation, please visit the detailed CPAN module installation guide.