CPAN::Audit::Version - the infrastructure to compare versions and
version ranges
use CPAN::Audit::Version;
my $cav = CPAN::Audit::Version->new;
$cav->in_range( $version, $range );
- •
- new
Create a new object. This ignores all arguments.
- affected_versions( ARRAY_REF, RANGE )
Given an array reference of versions, return a list of all of
the versions in ARRAY_REF that are in RANGE. This is really a filter on
ARRAY_REF using the values for which
"in_range" returns true.
my @matching = $cav->affected_versions( \@versions, $range );
- in_range( VERSION, RANGE )
Returns true if VERSION is contained in RANGE, and false
otherwise. VERSION is any sort of Perl, such as
1.23 or 1.2.3. The RANGE
is a comma-separated list of range specifications using the comparators
"<",
"<=",
"==",
">",
">=", or
"!=". For example,
">=1.23,<1.45",
"==1.23", or
">1.23".
my $version = 5.67;
my $range = '>=5,<6'; # so, all the versions in 5.x
if( $cav->in_range( $version, $range ) ) {
say "$version is within $range";
}
else {
say "$version is not within $range";
}
Copyright (C) Viacheslav Tykhanovskyi.
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
Viacheslav Tykhanovskyi <viacheslav.t@gmail.com>