Version::Compare(3pm)

πŸ“¦
version 0.14 Β· 2 versions
  • 0.14 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.14 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

okay so bestie, gather round β€” Version::Compare is a lil Perl module that does exactly one iconic thing: it compares version strings. that's it. that's the whole job. and it eats.


✨ VERSION ✨

version 0.14 β€” yes queen, we're on 0.14


🌸 SYNOPSIS 🌸

here's the vibe, copy it, paste it, live it:

use Version::Compare;

if(&Version::Compare::version_compare('2.6.26','2.6.0') == 1) {
    print "2.6.26 is greater than 2.6.0\n";
}

like. it literally tells you which version is bigger. main character behaviour fr fr πŸ’…


πŸ’– NAME πŸ’–

(again, because the original says it twice and we respect the canon)

Version::Compare β€” Comparing version strings


πŸ¦‹ SUBROUTINES/METHODS πŸ¦‹

max

returns the bigger of the two numerical values. that's it. pick the larger number, no drama, no notes. 🫢

version_compare

okay this is the star of the show. you give it two unix-style version strings (think 2.6.23.1 and 2.6.33) and it hands you back a sort-like return code:

  • 1 β€” the LHS is bigger (left-hand side ate, periodt)
  • 0 β€” they're equal (a tie, how very diplomatic)
  • -1 β€” the RHS is bigger (right-hand side took the crown)

and here's the ordering it lives by, verbatim, no cap:

0.0 < 0.5 < 0.10 < 0.99 < 1 < 1.0~rc1 < 1.0 < 1.0+b1 < 1.0+nmu1 < 1.1 <
2.0

cmp

see version_compare. literally just go read version_compare. it's giving alias energy. πŸ’€


πŸ‘‘ AUTHOR πŸ‘‘

Dominik Schulz, <dominik.schulz at gauner.org>


πŸ™ˆ BUGS πŸ™ˆ

found a bug? a feature request? a lil something that's lowkey not working? please report it to bug-version-compare at rt.cpan.org, or slide through the web interface at:

<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Version-Compare>

the deal is: I get notified, and then you automatically get notified of progress on your bug as I make changes. mutual updates, bestie. we love a two-way street. ✨


🌈 SUPPORT 🌈

you can find all the docs for this module with the perldoc command:

perldoc Version::Compare

and you can also go looking for info at:

  • RT: CPAN's request tracker

<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Version-Compare>

  • AnnoCPAN: Annotated CPAN documentation

<http://annocpan.org/dist/Version-Compare>

  • CPAN Ratings

<http://cpanratings.perl.org/d/Version-Compare>

  • Search CPAN

<http://search.cpan.org/dist/Version-Compare/>

go forth and lurk, it's a vibe πŸ’œ


Copyright 2012 Dominik Schulz

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See <http://dev.perl.org/licenses/> for more information.


πŸ‘‘ AUTHOR πŸ‘‘

(second round, she said it again)

Dominik Schulz <dominik.schulz@gauner.org>


This software is copyright (c) 2012 by Dominik Schulz.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


okay that's the whole page bestie, you're officially fluent πŸ’…

signing off from perl v5.36.0, dated 2022-11-19, filed under Version::Compare(3pm) β€” slay, stay hydrated, and go compare some versions 🧚✨

πŸ“¦ where this page comes from