Python::Version - Python PEP440 compatible version string parser in Perl
version 0.001
use Python::Version;
my $v = Python::Version->parse("1.2.3pre2.dev1+ubuntu-1");
print($v->normal);
print($v->original);
# Comparing versions
if ( Python::Version->parse($vstr1) == Python::Version->parse($vstr2) ) {
# do stuff
}
# Sorting versions
my @ordered = sort { Python::Version->parse($a) <=> Python::Version->parse($b) } @list;
This module provides a parser as well as comparion method for Python PEP440 compatible version string.
Class method. It takes a PEP440-compatible string and returns a Python::Version object.
my $v = Python::Version->parse($version_str);
Returns the normalized base part of the version.
Returns a boolean value for if the version is a pre-release.
Returns a boolean value for if the version is a post-release.
Returns a boolean value for if the version is a dev-release.
Returns the normalized local version label.
Returns a string with a standard normalized form.
Returns the original version string which was used to create the object.
Returns the normalized public version.
PEP 440 https://www.python.org/dev/peps/pep-0440/
Stephan Loyd sloyd@cpan.org
- perlancar perlancar@cpan.org
- Mohammad S Anwar manwar@cpan.org
This software is copyright (c) 2018-2023 by Stephan Loyd.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.