in reply to Dependent Package Requirement

If I understand you correctly, you want to package your module in a way that an attempt to install it won't also automatically cause either Archive::Zip or Archive::SevenZip to be installed, unless neither is already installed.

From looking at http://search.cpan.org/~dagolden/CPAN-Meta-2.150005/lib/CPAN/Meta/Spec.pm, I think the best you can do is make both optional ("recomends"), then have a test to make sure one of those is available.

You might be able to add code to Makefile.PL before the line with WriteMakefile, but I don't know how you could then get either archiver installed from there. Maybe you could do system 'cpan Archive::Zip';

Update: Looked again and found 1140942. Seems it is possible to modify MakeFile.PL to munge the prereqs.

Replies are listed 'Best First'.
Re^2: Dependent Package Requirement
by jandrew (Chaplain) on May 19, 2016 at 21:00 UTC

    RonW++ Thanks for replying. You have it right. Mostly I wouldn't ask but I know that at least one platform and several perl configurations fail to install Archive::Zip even though for now it is the preferred module to implement. The conundrum is how to succeed in the face of an imperfect module dependency.

    I was afraid that might be the answer. I'm planning on running some tests in a branch and see what I can get to happen in Travis-CI but I'm afraid it might take a hack on the cpan or cpanm apps to accomplish what I want. I will post to this thread as I have results but I have to get the test suite and module ready first so it will take several days before I know what won't work for sure.

      After looking some more, I found 1140942. Looks like you could add more prereqs. See stevieb's sample MakeFile.PL in that post.

      Depending on the return value of WriteMakefile, you might even be able to try Archive:Zip first, then Archive::SevenZip

        Thanks, It's good to know I'm not the first down this road. (I rarely ever am, its just hard to track the people before sometimes) It looks like I have some testing to do.