/usr/share/perl5/Version/Util.pm is in libversion-util-perl 0.71-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | package Version::Util;
use 5.010001;
use strict;
use version 0.77;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(
cmp_version
version_eq version_ne
version_lt version_le version_gt version_ge
version_between version_in
);
our $VERSION = '0.71'; # VERSION
sub cmp_version {
version->parse($_[0]) <=> version->parse($_[1]);
}
sub version_eq {
version->parse($_[0]) == version->parse($_[1]);
}
sub version_ne {
version->parse($_[0]) != version->parse($_[1]);
}
sub version_lt {
version->parse($_[0]) < version->parse($_[1]);
}
sub version_le {
version->parse($_[0]) <= version->parse($_[1]);
}
sub version_gt {
version->parse($_[0]) > version->parse($_[1]);
}
sub version_ge {
version->parse($_[0]) >= version->parse($_[1]);
}
sub version_between {
my $v = version->parse(shift);
while (@_) {
my $v1 = shift;
my $v2 = shift;
return 1 if $v >= version->parse($v1) && $v <= version->parse($v2);
}
0;
}
sub version_in {
my $v = version->parse(shift);
for (@_) {
return 1 if $v == version->parse($_);
}
0;
}
1;
# ABSTRACT: Version-number utilities
__END__
=pod
=encoding UTF-8
=head1 NAME
Version::Util - Version-number utilities
=head1 VERSION
version 0.71
=head1 DESCRIPTION
This module provides several convenient functions related to version numbers,
e.g. for comparing them.
=head1 FUNCTIONS
=head2 cmp_version($v1, $v2) => -1|0|1
Equivalent to:
version->parse($v1) <=> version->parse($v2)
=head2 version_eq($v1, $v2) => BOOL
=head2 version_ne($v1, $v2) => BOOL
=head2 version_lt($v1, $v2) => BOOL
=head2 version_le($v1, $v2) => BOOL
=head2 version_gt($v1, $v2) => BOOL
=head2 version_ge($v1, $v2) => BOOL
=head2 version_between($v, $v1, $v2[, $v1b, $v2b, ...]) => BOOL
=head2 version_in($v, $v1[, $v2, ...]) => BOOL
=head1 SEE ALSO
L<version>
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/Version-Util>.
=head1 SOURCE
Source repository is at L<https://github.com/sharyanto/perl-Version-Util>.
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website L<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.
=head1 AUTHOR
Steven Haryanto <stevenharyanto@gmail.com>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Steven Haryanto.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|