Mini Shell
Direktori : /usr/local/share/man/man3/ |
|
Current File : //usr/local/share/man/man3/Alien::Build::Version::Basic.3pm |
.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "Alien::Build::Version::Basic 3"
.TH Alien::Build::Version::Basic 3 "2024-10-29" "perl v5.32.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Alien::Build::Version::Basic \- Very basic version object for Alien::Build
.SH "VERSION"
.IX Header "VERSION"
version 2.84
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
\&\s-1OO\s0 interface:
.PP
.Vb 1
\& use Alien::Build::Version::Basic;
\&
\& my $version = Alien::Build::Version::Basic\->new(\*(Aq1.2.3\*(Aq);
\& if($version > \*(Aq1.2.2\*(Aq) # true
\& {
\& ...
\& }
.Ve
.PP
Function interface:
.PP
.Vb 1
\& use Alien::Build::Version::Basic qw( version );
\&
\& if(version(\*(Aq1.2.3\*(Aq) > version(\*(Aq1.2.2\*(Aq)) # true
\& {
\& ...
\& }
\&
\& my @sorted = sort map { version($_) } qw( 2.1 1.2.3 1.2.2 );
\& # will come out in the order 1.2.2, 1.2.3, 2.1
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module provides a very basic class for comparing versions.
This is already a crowded space on \s-1CPAN.\s0 Parts of Alien::Build
already use Sort::Versions, which is fine for sorting versions.
Sometimes you need to compare to see if versions match exact \fIvalues\fR,
and the best candidates (such as Sort::Versions on \s-1CPAN\s0 compare
\&\f(CW1.2.3.0\fR and \f(CW1.2.3\fR as being different. This class compares
those two as the same.
.PP
This class is also quite limited, in that it only works with version
schemes using a doted version numbers or real numbers with a fixed
number of digits. Versions with: dashes, letters, hex digits, or
anything else are not supported.
.PP
This class overloads both \f(CW\*(C`<=>\*(C'\fR and \f(CW\*(C`cmp\*(C'\fR to compare the version in
the way that you would expect for version numbers. This way you can
compare versions like numbers, or sort them using sort.
.PP
.Vb 4
\& if(version($v1) > version($v2))
\& {
\& ...
\& }
\&
\& my @sorted = sort map { version($_) } @unsorted;
.Ve
.PP
it also overloads \f(CW""\fR to stringify as whatever string value you
passed to the constructor.
.SH "CONSTRUCTOR"
.IX Header "CONSTRUCTOR"
.SS "new"
.IX Subsection "new"
.Vb 1
\& my $version = Alien::Build::Version::Basic\->new($value);
.Ve
.PP
This is the long form of the constructor, if you don't want to import
anything into your namespace.
.SS "version"
.IX Subsection "version"
.Vb 1
\& my $version = version($value);
.Ve
.PP
This is the short form of the constructor, if you are sane. It is
\&\s-1NOT\s0 exported by default so you will have to explicitly import it.
.SH "METHODS"
.IX Header "METHODS"
.SS "as_string"
.IX Subsection "as_string"
.Vb 2
\& my $string = $version\->as_string;
\& my $string = "$version";
.Ve
.PP
Returns the string representation of the version object.
.SS "cmp"
.IX Subsection "cmp"
.Vb 3
\& my $bool = $version\->cmp($other);
\& my $bool = $version <=> $other;
\& my $bool = $version cmp $other;
.Ve
.PP
Returns \f(CW\*(C`\-1\*(C'\fR, \f(CW0\fR or \f(CW1\fR just like the regular \f(CW\*(C`<=>\*(C'\fR and \f(CW\*(C`cmp\*(C'\fR
operators. Although \f(CW$version\fR must be a version object, \f(CW$other\fR may
be either a version object, or a string that could be used to create a
valid version object.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
.IP "Sort::Versions" 4
.IX Item "Sort::Versions"
Good, especially if you have to support rpm style versions (like \f(CW\*(C`1.2.3\-2\-b\*(C'\fR)
or don't care if trailing zeros (\f(CW1.2.3\fR vs \f(CW1.2.3.0\fR) are treated as
different values.
.IP "version" 4
.IX Item "version"
Problematic for historical reasons.
.SH "AUTHOR"
.IX Header "AUTHOR"
Author: Graham Ollis <plicease@cpan.org>
.PP
Contributors:
.PP
Diab Jerius (\s-1DJERIUS\s0)
.PP
Roy Storey (\s-1KIWIROY\s0)
.PP
Ilya Pavlov
.PP
David Mertens (run4flat)
.PP
Mark Nunberg (mordy, mnunberg)
.PP
Christian Walde (Mithaldu)
.PP
Brian Wightman (MidLifeXis)
.PP
Zaki Mughal (zmughal)
.PP
mohawk (mohawk2, \s-1ETJ\s0)
.PP
Vikas N Kumar (vikasnkumar)
.PP
Flavio Poletti (polettix)
.PP
Salvador Fandiño (salva)
.PP
Gianni Ceccarelli (dakkar)
.PP
Pavel Shaydo (zwon, trinitum)
.PP
Kang-min Liu (劉康民, gugod)
.PP
Nicholas Shipp (nshp)
.PP
Juan Julián Merelo Guervós (\s-1JJ\s0)
.PP
Joel Berger (\s-1JBERGER\s0)
.PP
Petr Písař (ppisar)
.PP
Lance Wicks (\s-1LANCEW\s0)
.PP
Ahmad Fatoum (a3f, \s-1ATHREEF\s0)
.PP
José Joaquín Atria (\s-1JJATRIA\s0)
.PP
Duke Leto (\s-1LETO\s0)
.PP
Shoichi Kaji (\s-1SKAJI\s0)
.PP
Shawn Laffan (\s-1SLAFFAN\s0)
.PP
Paul Evans (leonerd, \s-1PEVANS\s0)
.PP
Håkon Hægland (hakonhagland, \s-1HAKONH\s0)
.PP
nick nauwelaerts (\s-1INPHOBIA\s0)
.PP
Florian Weimer
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
This software is copyright (c) 2011\-2022 by Graham Ollis.
.PP
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
Zerion Mini Shell 1.0