1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
NAME
Version::Util - Version-number utilities
VERSION
This document describes version 0.732 of Version::Util (from Perl
distribution Version-Util), released on 2022-09-22.
DESCRIPTION
This module provides several convenient functions related to version
numbers, e.g. for comparing them.
FUNCTIONS
cmp_version($v1, $v2) => -1|0|1
Equivalent to:
version->parse($v1) <=> version->parse($v2)
version_eq($v1, $v2) => BOOL
version_ne($v1, $v2) => BOOL
version_lt($v1, $v2) => BOOL
version_le($v1, $v2) => BOOL
version_gt($v1, $v2) => BOOL
version_ge($v1, $v2) => BOOL
version_between($v, $v1, $v2[, $v1b, $v2b, ...]) => BOOL
version_in($v, $v1[, $v2, ...]) => BOOL
min_version($v1, ...) => $max_v
max_version($v1, ...) => $max_v
add_version($v, $increment) => $new_v
Add $increment to version $v. Both increment and version must match:
/\Av?\d{1,3}(?:\.\d{1,3}){0,2}\z/
so trial/dev releases like "v1.2.3_1" are not currently supported. Some
examples:
0.1 + 0.1 -> 0.2
0.01 + 0.001 -> 0.011
0.01 + 0.1 -> 0.11
0.9 + 0.1 -> 1.0
0.99 + 0.1 -> 1.09
1.1.0 + 0.0.1 -> 1.1.1
subtract_version($v, $decrement) => $new_v
Subtract $decrement from version $v. This is the reverse operation for
"add_version".
Will die if the result is negative.
HOMEPAGE
Please visit the project's homepage at
<https://metacpan.org/release/Version-Util>.
SOURCE
Source repository is at
<https://github.com/perlancar/perl-Version-Util>.
SEE ALSO
version
AUTHOR
perlancar <perlancar@cpan.org>
CONTRIBUTOR
Steven Haryanto <stevenharyanto@gmail.com>
CONTRIBUTING
To contribute, you can send patches by email/via RT, or send pull
requests on GitHub.
Most of the time, you don't need to build the distribution yourself. You
can simply modify the code, then test via:
% prove -l
If you want to build the distribution (e.g. to try to install it locally
on your system), you can install Dist::Zilla,
Dist::Zilla::PluginBundle::Author::PERLANCAR,
Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two
other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps
required beyond that are considered a bug and can be reported to me.
COPYRIGHT AND LICENSE
This software is copyright (c) 2022, 2018, 2014 by perlancar
<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.
BUGS
Please report any bugs or feature requests on the bugtracker website
<https://rt.cpan.org/Public/Dist/Display.html?Name=Version-Util>
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.
|