Perl-Toolchain-Gang / CPAN-Meta-Requirements

a set of version requirements for a CPAN dist
5 stars 15 forks source link

Bad handling of small fractional numeric versions #30

Open haarg opened 8 years ago

haarg commented 8 years ago

If a version number is passed in numeric form, C::M::R will use its stringified form for all its processing. This doesn't play well with small fractional versions like 0.000005, which will be stringified as '5e-06', and thus rejected as invalid. For values that are numeric (possibly checked via looks_like_number or B flags) it should stringify them using sprintf '%f' instead.

Leont commented 8 years ago

version.pm already contains logic to handle that, I suspect that would be the most logical route.

ronsavage commented 8 years ago

The problem seems to be a bit more subtle. This is accepted: PREREQ_PM { 'Try::Tiny' => 0.09, # Fake V for testing. } but this: TEST_REQUIRES => { 'Test2::Bundle::Extended' => 0.09, } produces the error: Unparsable version '3e-05' for prerequisite Test2::Bundle::Extended treated as 3 at /home/ron/perl5/perlbrew/perls/perl-5.20.2/lib/site_perl/5.20.2/CPAN/Meta/Requirements.pm line 140.

Since the version # for Try::Tiny is faked, that of course produces a separate warning, but I assume by the time this warning: Unparsable version '3e-05' for prerequisite Test2::Bundle::Extended treated as 3 at /home/ron/perl5/perlbrew/perls/perl-5.20.2/lib/site_perl/5.20.2/CPAN/Meta/Requirements.pm line 140. is produced, what's happened is that your module is somehow handling the version #s in the 2 categories differently.

ronsavage commented 8 years ago

I found that by doing this: 'Test2::Bundle::Extended' => '0.000030', everything worked as expected. And no, I do not have to quote 'Try::Tiny' => 0.09.