gugod/App-perlbrew — Issue #194: format_perl_version causes warning with 5.8.0
Author: jtbraun
Created: 2012-02-19 20:13:52+00:00
State: open

If you install perl-5.8.0, most perlbrew commands complain about a non-numeric argument:
> perlbrew list
Argument "" isn't numeric in sprintf at /loader/0x86d4f74/App/perlbrew.pm line 186.
* perl-5.8.0

I believe that format_perl_version should include "|| 0" for the second and third substr() calls, as shown below:

sub format_perl_version {
my $self = shift;
my $version = shift;
return sprintf "%d.%d.%d",
substr( $version, 0, 1 ),
substr( $version, 2, 3 ) || 0,
substr( $version, 5 ) || 0;

}