SemVer::V2::Strict - Semantic version v2.0 object for Perl
use SemVer::V2::Strict; my $v1 = SemVer::V2::Strict->new('1.0.2'); my $v2 = SemVer::V2::Strict->new('2.0.0-alpha.10'); if ($v1 < $v2) { print "$v1 < $v2\n"; # => '1.0.2 < 2.0.0-alpha.10' }
This module subclasses version to create semantic versions, as defined by the Semantic Versioning 2.0.0 Specification.
new()
Create new empty SemVer::V2::Strict instance. SemVer::V2::Strict->new() equals SemVer::V2::Strict->new('0.0.0').
SemVer::V2::Strict
SemVer::V2::Strict->new()
SemVer::V2::Strict->new('0.0.0')
new($version_string)
Create new SemVer::V2::Strict instance from a version string. SemVer::V2::Strict->new('1.0.0') equals SemVer::V2::Strict->new(1, 0, 0).
SemVer::V2::Strict->new('1.0.0')
SemVer::V2::Strict->new(1, 0, 0)
new($major, $minor = 0, $patch = 0, $pre_release = undef, $build_metadata = undef)
Create new SemVer::V2::Strict instance from version numbers. SemVer::V2::Strict->new('1.0.0-alpha+100') equals SemVer::V2::Strict->new(1, 0, 0, 'alpha', '100').
SemVer::V2::Strict->new('1.0.0-alpha+100')
SemVer::V2::Strict->new(1, 0, 0, 'alpha', '100')
clean($version_string)
Clean version string. Trim spaces and 'v' prefix.
'v'
sort(... $version_string)
Sort version strings.
major
Get the major version number.
minor
Return the minor version number.
patch
Return the patch version number.
pre_release
Return the pre_release string.
build_metadata
Return the build_metadata string.
<=>
Compare two SemVer::V2::Strict instances.
""
Convert a SemVer::V2::Strict instance to string.
as_string()
SemVer
version
The MIT License (MIT)
Copyright (c) 2015-2019 Pine Mizune
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SemVer::V2::Strict is based from rosylilly's semver. Thank you.
Pine Mizune <pinemz@gmail.com>
To install SemVer::V2::Strict, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SemVer::V2::Strict
CPAN shell
perl -MCPAN -e shell install SemVer::V2::Strict
For more information on module installation, please visit the detailed CPAN module installation guide.