Version::Next(3pm)

πŸ“¦
version 1.000 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Version::Next πŸ’–

okay bestie, so this is Version::Next β€” it's a Perl module from the User Contributed Perl Documentation corner of the world, and it does exactly one thing but it does it flawlessly. it bumps your module version number. simply. correctly. no drama. πŸ’…


✨ VERSION ✨

this is version 1.000, bestie. vintage but iconic.


🌸 SYNOPSIS 🌸

use Version::Next qw/next_version/;

my $new_version = next_version( $old_version );

that's literally it. one import, one function call, one slayed version number. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: this module gives you a simple, correct way to increment a Perl module version number. it does not try to guess what the original author meant β€” it's not a mind reader, it's not your therapist, it just increments in the smallest possible fashion. no cap.

  • decimals get incremented like an odometer β€” the way a car's mileage just rolls over, yk?
  • dotted decimals get incremented piecewise and then presented in a standardized way. chef's kiss.

and if you need something more complex than this? if you're out here wanting fancy version manipulation? you may wish to consider Perl::Version. she's the overachiever of the group. 🫢


🌈 USAGE 🌈

this module uses Sub::Exporter for optional exporting. and by "optional" I mean nothing is exported by default, bestie. you have to ask for it. consent is key. ✨

πŸ’œ next_version

my $new_version = next_version( $old_version );

give it a string and this function makes the smallest logical increment and hands it right back to you. πŸ’–

okay but the deets matter so listen up:

  • the input string must be a "lax" version number as defined by the version module. don't come at her with anything else.
  • the string "undef" is treated as 0 and incremented to 1. (the string, bestie. we'll get to the other undef in a sec. 😭)
  • leading or trailing periods get a 0 (or "v0") prepended or appended as appropriate. she's tidying up after you, as always.
  • for legacy reasons, if you give no argument at all, or a literal undef (not the string "undef", the actual literal thing), the function returns 0. yes, this is a jump scare. it's fine. it's legacy.

πŸ“ decimal versions

decimal versions are incremented like an odometer, and the original number of decimal places is preserved. if an underscore is present β€” that's the sign of an "alpha" version, iykyk β€” its relative position is preserved too. examples, feast your eyes:

0.001    ->   0.002
0.999    ->   1.000
0.1229   ->   0.1230
0.12_34  ->   0.12_35
0.12_99  ->   0.13_00

look at that rollover on 0.999 -> 1.000. she ate. πŸ”₯

⭐ dotted-decimal versions

for dotted-decimal versions, the least significant element gets incremented by one. if the result exceeds 999, that element resets to 0 and the next most significant element gets incremented, and so on and so on, up the chain like a little domino effect. any leading zero padding is removed. examples:

v1.2.3     ->  v1.2.4
v1.2.999   ->  v1.3.0
v1.999.999 ->  v2.0.0

the way v1.999.999 cascades all the way to v2.0.0?? main character energy fr fr. πŸ‘‘

NOTE: okay bestie this one's important, no cap. due to changes in the interpretation of dotted-decimal version numbers with alpha elements in version 0.9913 and later, the notion of the 'next' dotted-decimal alpha is ill-defined. so Version::Next no longer supports dotted-decimals with alpha elements, and a fatal exception will be thrown if one is provided to next_version. πŸ’€ don't do it. she will not catch you. she will let you fall.

πŸ” SEE ALSO πŸ”

  • version
  • Perl::Version

🫢 SUPPORT 🫢

πŸ™ˆ Bugs / Feature Requests

please report any bugs or feature requests through the issue tracker at:

<https://github.com/dagolden/Version-Next/issues>

you'll be notified automatically of any progress on your issue. so you'll never be left on read. πŸ’…

🧚 Source Code

this is open source software! the code repository is available for public review and contribution under the terms of the license.

<https://github.com/dagolden/Version-Next>

git clone https://github.com/dagolden/Version-Next.git

go on, clone her. she's waiting. 🌸


πŸ‘‘ AUTHOR πŸ‘‘

David Golden <dagolden@cpan.org>

πŸ’– CONTRIBUTOR πŸ’–

Grzegorz RoΕΌniecki <xaerxess@gmail.com>


this software is Copyright (c) 2016 by David Golden.

this is free software, licensed under:

The Apache License, Version 2.0, January 2004

and that's the whole page bestie!! 🌈✨ this one's from perl v5.34.0 and dated 2022-06-28 β€” yeah she's a little vintage, but she's still slaying. bye pookie, go increment something responsibly πŸ’œπŸŽ€