-
Notifications
You must be signed in to change notification settings - Fork 15
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
strip underscore from versions when considering "accepts module" #28
Comments
cpanm just uses CMR, I think? EUMM does the s///, then passes it to CMR. Not sure what CPAN.pm does (it definitely strips, but I dunno if it uses CMR or its own code still) |
is this related to #26? If so, stripping alpha-ness from I usually don't lurk on #distzilla so a summary for that, or a specific problem that you need to address with an actual failing example, would be helpful for me to complete the context. also - yes, cpanm uses CMR, hence miyagawa/cpanminus/issues/463 and #26 |
Yes. I don't understand the (presumably failing?) example in #26 though; can someone clarify? |
suppose you have installed a dev version of Foo 2.000_001 from CPAN. package Foo;
our $VERSION = '2.000_001'; and your code has a requirement for This issue is about making that requirement pass, by eliminating That's fine until in the runtime you have a code that says: use Foo 2.000001; at this point perl will blow up: |
We covered that in the #distzilla discussion -- the conclusion was basically That is -- any author that declares an underscore version but doesn't include a follow-up line |
Well, it's not just "authors" who does this - it could be an end user, or a tool (a la PrereqScanner, cpanfile, Module::Metadata) that programatically ends up calling I honestly don't have a strong preference, but just wanted to point out that this issue contains an incorrect assumption (which you've covered as a wrong usage, just fine) and will possibly lead to a technical debt. |
I think you misunderstood. It's only authors that are declaring $VERSIONs with an underscore but neglecting the |
But it's not OK to call, if the installed version is a devel release and there's no The end result of this is that, as an end user, even if you have |
Why is that relevant for this discussion? It's not safe to call today if there's no eval by the author. The breakage isn't made worse, and the code was just as wrong yesterday as it is today. |
Sure, but you do know that it's not safe, because tools (i.e. cpanm or CPAN::Meta::Requirements) tells you that the installed version doesn't satisfy your requirement before running that code. |
I'm merely pointing out that, by accepting this change, there'll be a mismatch in a list of prereqs and runtime perl's UNIVERSAL:::VERSION behavior. i.e. if a user installs a dev version of the module, the user can't specifically require that version. If we all think that is a use case that can be ignored, and using a module with |
Here's a convoluted scenario:
Today, because '2.0_1' doesn't satisfy the requirement '2.01' cpanm will try to upgrade to the "non-dev" version of Foo. With this change, cpanm will fail to upgrade it because '2.0_1' will now satisfy '2.01'. In addition a runtime call of Again, this is convoluted, and it must be an author A's fault of reusing the same version number in non-dev and dev. Just wanted to point out that, by accepting this change we're deprecating the currently supported scenario. Look, I'm the one who requested this first in #26 :) |
I'd rather fix this in version.pm |
Me too. But can we do both? I suspect the CMR fix will be faster to implement, so it can at least move the problem one layer lower while we fret with what to change in version.pm. |
As discussed on irc (#distzilla, 2015-07-15), the underscore in a module's $VERSION should be stripped before passing it to version.pm in
accepts_module()
(or a private submethod thereof). This will restore consistency with CPAN.pm and other tools.(We also need to ensure cpanm and Module::Build do the same thing.)
cc @miyagawa @Leont @shadowcat-mst
The text was updated successfully, but these errors were encountered: