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

Unable to disambiguate a module name from a local file of the same name #564

Closed
rivy opened this issue Apr 8, 2018 · 4 comments
Closed

Comments

@rivy
Copy link

rivy commented Apr 8, 2018

When trying to install a module (eg, "version"), if the current directory contains a matching file name, it isn't possible to direct cpanm to download and install the module from CPAN. cpanm will always attempt to install the from the local file.

# eg

touch version
cpanm version ; # fails

touch "ExtUtils::ParseXS"
cpanm ExtUtils::ParseXS ; # fails

This is especially problematic for single named modules (eg, "Graph", "parent", or "version"), which are far more likely to have a matching file. But filenames with internal "::" are obviously a possible problem, as well.

This issue crops up when using CI scripts for testing. Test failures may occur which are not due to actual module bugs, but instead due to a new file check-in which clashes with a cpanm module installation.

The only currently safe workaround that I've found is to use cpanm from an empty directory.

@miyagawa
Copy link
Owner

miyagawa commented Apr 8, 2018

This is a known issue. I recommend to use cpanfile to install modules without being addected by the local file systems.

rivy added a commit to rivy/perl.File-Globstar that referenced this issue Apr 9, 2018
@rivy
Copy link
Author

rivy commented Apr 16, 2018

Thanks for the quick response.

Using "cpanfile" might work for my personal modules, but I'm trying to add a more broadly useful AppVeyor configuration that can be used for modules owned by others. Requiring "cpanfile" for everyone doesn't seem to be a workable solution.

I was hoping you'd consider some other disambiguation method, such as an option flag or a protocol prefix (eg, cpan://version or net://version).

@miyagawa
Copy link
Owner

IMO using cpanfipe would be more acceptable that using command line arguments since more tools and CI ecosystems support it, such as Travis CI's Perl setup does out of the box.

@rivy
Copy link
Author

rivy commented May 5, 2018

I've hacked around this issue for my use on AppVeyor, but it's just that... a hack.

And, IMHO, this ambiguity at the CLI of cpanm is still a bug with the tool itself, which could be fairly easily fixed. But, if it's a "won't fix" for you, it'd likely be helpful to at least note the issue in the tool's documentation.

Thanks again for your attention.

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

2 participants