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

Merge multiple requirements for a module #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ianburrell
Copy link

Currently, if requirement for module is listed multiple times, the version from the last declaration overrides any previous requires. This can produce unexpected behavior when there are duplicate declarations with versions. This can happen when including multiple files; we use git submodules with cpanfile included into main project with "do". But this could happen with large files or merges. This could produce an error.

It would be better if the versions from the declarations were combined. Versions are combined with a comma to produce version ranges. Illegal ranges produce errors in CPAN::Meta::Requirements. CPAN::Meta::Requirements handles combining ranges to produce the inclusive range.

@miyagawa
Copy link
Owner

I don't think this has to be done on this layer. Carton actually manages this by using CPAN::Meta::Requirements like you suggest. Module::CPANfile is a utility to parse the content of cpanfile, and interpreting them should be left up to the utility that uses cpanfile.

Supports multiple requires lines with versions. This is useful when
combining files with duplicates module declarations. Versions are
combined with a comma to produce version ranges. Illegal ranges
produce errors in CPAN::Meta::Requirements.
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

Successfully merging this pull request may close these issues.

2 participants