From: Graham Knop Date: Fri, 3 Sep 2021 11:00:45 +0000 (+0200) Subject: fix bumpmajor X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=70bb577e538b9a329753a106715fc00e8673f6c7;p=p5sagit%2FDistar.git fix bumpmajor --- diff --git a/lib/Distar/helpers/bump-version b/lib/Distar/helpers/bump-version index d6967e5..2aad1fe 100755 --- a/lib/Distar/helpers/bump-version +++ b/lib/Distar/helpers/bump-version @@ -227,7 +227,12 @@ sub bump_version { my $cut_len = $bump_this * 3; $dec_len = $cut_len if $dec_len < $cut_len; - $new_decimal =~ s/(\..{1,$cut_len}).*/$1/; + if ($cut_len) { + $new_decimal =~ s/(\..{1,$cut_len}).*/$1/; + } + else { + $new_decimal =~ s/\..*//; + } } $new_decimal += 10 ** -($bump_this == -1 ? $dec_len : ($bump_this * 3)); $new_decimal = sprintf "%.${dec_len}f", $new_decimal;