Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad handling of small fractional numeric versions #30

Open
haarg opened this issue Apr 27, 2016 · 3 comments
Open

Bad handling of small fractional numeric versions #30

haarg opened this issue Apr 27, 2016 · 3 comments

Comments

@haarg
Copy link
Member

haarg commented Apr 27, 2016

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
Copy link
Member

Leont commented Apr 27, 2016

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

@ronsavage
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants