1Alien::Build::Version::UBsaesricC(o3n)tributed Perl DocuAmleinetna:t:iBounild::Version::Basic(3)
2
3
4

NAME

6       Alien::Build::Version::Basic - Very basic version object for
7       Alien::Build
8

VERSION

10       version 2.38
11

SYNOPSIS

13       OO interface:
14
15        use Alien::Build::Version::Basic;
16
17        my $version = Alien::Build::Version::Basic->new('1.2.3');
18        if($version > '1.2.2')  # true
19        {
20          ...
21        }
22
23       Function interface:
24
25        use Alien::Build::Version::Basic qw( version );
26
27        if(version('1.2.3') > version('1.2.2')) # true
28        {
29          ...
30        }
31
32        my @sorted = sort map { version($_) } qw( 2.1 1.2.3 1.2.2 );
33        # will come out in the order 1.2.2, 1.2.3, 2.1
34

DESCRIPTION

36       This module provides a very basic class for comparing versions.  This
37       is already a crowded space on CPAN.  Parts of Alien::Build already use
38       Sort::Versions, which is fine for sorting versions.  Sometimes you need
39       to compare to see if versions match exact values, and the best
40       candidates (such as Sort::Versions on CPAN compare 1.2.3.0 and 1.2.3 as
41       being different.  This class compares those two as the same.
42
43       This class is also quite limited, in that it only works with version
44       schemes using a doted version numbers or real numbers with a fixed
45       number of digits.  Versions with: dashes, letters, hex digits, or
46       anything else are not supported.
47
48       This class overloads both "<=>" and "cmp" to compare the version in the
49       way that you would expect for version numbers.  This way you can
50       compare versions like numbers, or sort them using sort.
51
52        if(version($v1) > version($v2))
53        {
54          ...
55        }
56
57        my @sorted = sort map { version($_) } @unsorted;
58
59       it also overloads "" to stringify as whatever string value you passed
60       to the constructor.
61

CONSTRUCTOR

63   new
64        my $version = Alien::Build::Version::Basic->new($value);
65
66       This is the long form of the constructor, if you don't want to import
67       anything into your namespace.
68
69   version
70        my $version = version($value);
71
72       This is the short form of the constructor, if you are sane.  It is NOT
73       exported by default so you will have to explicitly import it.
74

METHODS

76   as_string
77        my $string = $version->as_string;
78        my $string = "$version";
79
80       Returns the string representation of the version object.
81
82   cmp
83        my $bool = $version->cmp($other);
84        my $bool = $version <=> $other;
85        my $bool = $version cmp $other;
86
87       Returns "-1", 0 or 1 just like the regular "<=>" and "cmp" operators.
88       Although $version must be a version object, $other may be either a
89       version object, or a string that could be used to create a valid
90       version object.
91

SEE ALSO

93       Sort::Versions
94           Good, especially if you have to support rpm style versions (like
95           "1.2.3-2-b") or don't care if trailing zeros (1.2.3 vs 1.2.3.0) are
96           treated as different values.
97
98       version
99           Problematic for historical reasons.
100

AUTHOR

102       Author: Graham Ollis <plicease@cpan.org>
103
104       Contributors:
105
106       Diab Jerius (DJERIUS)
107
108       Roy Storey (KIWIROY)
109
110       Ilya Pavlov
111
112       David Mertens (run4flat)
113
114       Mark Nunberg (mordy, mnunberg)
115
116       Christian Walde (Mithaldu)
117
118       Brian Wightman (MidLifeXis)
119
120       Zaki Mughal (zmughal)
121
122       mohawk (mohawk2, ETJ)
123
124       Vikas N Kumar (vikasnkumar)
125
126       Flavio Poletti (polettix)
127
128       Salvador Fandiño (salva)
129
130       Gianni Ceccarelli (dakkar)
131
132       Pavel Shaydo (zwon, trinitum)
133
134       Kang-min Liu (劉康民, gugod)
135
136       Nicholas Shipp (nshp)
137
138       Juan Julián Merelo Guervós (JJ)
139
140       Joel Berger (JBERGER)
141
142       Petr Pisar (ppisar)
143
144       Lance Wicks (LANCEW)
145
146       Ahmad Fatoum (a3f, ATHREEF)
147
148       José Joaquín Atria (JJATRIA)
149
150       Duke Leto (LETO)
151
152       Shoichi Kaji (SKAJI)
153
154       Shawn Laffan (SLAFFAN)
155
156       Paul Evans (leonerd, PEVANS)
157
158       Håkon Hægland (hakonhagland, HAKONH)
159
161       This software is copyright (c) 2011-2020 by Graham Ollis.
162
163       This is free software; you can redistribute it and/or modify it under
164       the same terms as the Perl 5 programming language system itself.
165
166
167
168perl v5.32.0                      2021-01-12   Alien::Build::Version::Basic(3)
Impressum