.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" 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 "Linux::KernelSort 3pm" .TH Linux::KernelSort 3pm "2020-12-22" "perl v5.32.0" "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" Linux::KernelSort \- Perl extension for sorting and comparing Linux kernel versions. The expected kernel version naming convention is the same naming convetion demonstrated by http://www.kernel.org. NOTE: Currently, only the 2.6.x series of kernels (including \-rc's, \&\-git's, and \-mm's) are properly evaluated. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Linux::KernelSort; \& my $kernel = new Linux::KernelSort; \& \& my $ret; \& my $version1 = "2.6.19"; \& my $version2 = "2.6.19\-rc2\-git7"; \& $ret = $kernel\->compare($version1, $version2); \& \& if ($ret == 0) { \& print "$version1 and $version2 are the same version\en"; \& } elsif ($ret > 0) { \& print "$version1 is newer than $version2\en"; \& } else { \& print "$version1 is older than $version2\en"; \& } \& \& my @kernel_list = ( \*(Aq2.6.15\*(Aq, \& \*(Aq2.6.18\*(Aq, \& \*(Aq2.6.18\-rc2\*(Aq, \& \*(Aq2.6.18\-rc2\-git2\*(Aq, \& \*(Aq2.6.18\-mm1\*(Aq, \& \*(Aq2.6.18\-rc2\-mm1\*(Aq ); \& \& my @sorted_list = $kernel\->sort(@kernel_list); \& \& print join( \*(Aq, \*(Aq, @sorted_list ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Linux::KernelSort is intended to sort a list of kernel versions into ascending order. It also provides the capability to compare two kernel versions and determine if one version is newer, older, or the same as the other version. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .SS "\fBversion_check()\fP Purpose: Verify the version is valid and follows the proper naming convention demonstrated by http://www.kernel.org Input: A string containing the kernel version Return: 0 if version is valid 1 if version is invalid" .IX Subsection "version_check() Purpose: Verify the version is valid and follows the proper naming convention demonstrated by http://www.kernel.org Input: A string containing the kernel version Return: 0 if version is valid 1 if version is invalid" .SS "\fBrank()\fP" .IX Subsection "rank()" .Vb 5 \& Purpose: Generate a ranking for a given kernel version \& Input: A string containing the kernel version which \& follows the proper naming convention demonstrated \& by http://www.kernel.org \& Return: Kernel ranking .Ve .SS "\fBcompare()\fP" .IX Subsection "compare()" .Vb 7 \& Purpose: Compare two kernel versions \& Input: Strings ($kernel1, $kernel2) each containing a \& kernel version which follows the proper naming \& conventaion demonstrated by http://www.kernel.org \& Return \-1 if $kernel1 < $kernel2 (ie $kernel1 is older than $kernel2) \& 0 if $kernel1 == $kernel2 (ie $kernel1 is the same version as $kernel2) \& 1 if $kernel1 > $kernel2 (ie $kernel1 is newer than $kernel2) .Ve .SS "\fBsort()\fP" .IX Subsection "sort()" .Vb 6 \& Purpose: Sort a list of kernel versions in ascending order. \& Uses shell sort algorithm. \& Input: Array of strings containing kernel versions which \& follows the proper naming convention demonstrated \& by http://www.kernel.org \& Return: Sorted array .Ve .SH "AUTHOR" .IX Header "AUTHOR" Leann Ogasawara ogasawara@osdl.org .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Linux-KernelSort is Copyright (c) 2006, by Leann Ogasawara. All rights reserved. You may distribute this code under the terms of either the \s-1GNU\s0 General Public License or the Artistic License, as specified in the Perl \s-1README\s0 file.