Skip Menu |

This queue is for tickets about the Math-Int2Base CPAN distribution.

Report information
The Basics
Id: 117023
Status: open
Priority: 0/
Queue: Math-Int2Base

People
Owner: Nobody in particular
Requestors: DANAJ [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.00
Fixed in: (no value)



Subject: Warning in 5.21+
In 5.21.1, a new warning was added for negative repeat counts. This continues in the non-dev releases, including 5.24.0. perl -E 'use Math::Int2Base qw/int2base base2int/; say int2base(255, 16)' Negative repeat count does nothing at [...]lib/site_perl/5.24.0/Math/Int2Base.pm line 38. FF The hackiest way to fix this is to put "no warnings;" on the line before int2base returns. There are probably less hammer-ish ways to avoid it.
Quick patch I made to my local install to stop all those warnings: --- /usr/local/share/perl5/Math/Int2Base.pm~ 2011-07-05 11:56:03.000000000 -0400 +++ /usr/local/share/perl5/Math/Int2Base.pm 2017-04-12 17:17:42.447921595 -0400 @@ -35,5 +35,7 @@ for (; $num; $num = int($num/$base) ) { $ret .= $Chars[$num % $base] } - return scalar reverse $ret . '0'x($minlen - length($ret)); + my $repeat = $minlen - length($ret); + $repeat = 0 if $repeat < 0; + return scalar reverse $ret . '0'x($repeat); }