bliako has asked for the wisdom of the Perl Monks concerning the following question:

I have my own module which has some dependencies which are listed in its Makefile.PL (and I am using ExtUtils::MakeMaker). I want to install/upgrade all the dependencies listed in the Makefile.PL without first doing a make install in my module. Essentially: I take my distribution to another computer, I unpack it and then I want to be able to tell it to install all dependent modules. I have seen something like this cpanm --installdeps DISTDIR but that stops soon without complains but without doing any install/upgrades.

It's important that I don't install the module itself (as in make install) because it is in development and I want to work with its blib/lib at the moment. But I do want all its dependencies to be installed system-wide as Administrator.

Replies are listed 'Best First'.
Re: Install dependencies of module
by Haarg (Priest) on Mar 07, 2023 at 20:00 UTC

    Is the problem that it isn't upgrading modules that are already installed? Or that it isn't installing them at all?

    If the problem is that it isn't upgrading the dependencies, you can do that with a command like cpanm --showdeps -q . | cpanm

    If the problem is that it isn't installing the dependencies, it's really hard to say without more information. cpanm --showdeps . may help see what dependencies are being seen. But "stops soon without complains" doesn't give much to go on. cpanm's -v flag may help.

      Thanks Haarg, your suggestion: cpanm --showdeps -q . | cpanm worked just fine. And they are being installed/updated.

Re: Install dependencies of module
by kcott (Archbishop) on Mar 07, 2023 at 15:49 UTC

    G'day bliako,

    "I take my distribution to another computer"

    I assume by "distribution" you mean something like Some-Module-9.99.tar.gz. Create a new directory on your target computer and put the distribution there. Don't unpack it. Just run "cpanm --installdeps ." from that directory. As per the linked documentation, this "Installs the dependencies of the target distribution but won't build itself". You might also add "--verbose" to get more feedback about what's happening.

    — Ken

      Hello kcott, Yes, I have the tarball as you describe. But I would prefer that I do it from inside the dist dir (which is where I ran the cpanm --installdeps . from) as I am constantly developing this and it's likely that I will add a dependency on the fly and want to have it installed like this. It's much more convenient this way I find.

      Edit: I can create the tarball with a make dist inside the distribution dir but cpanm --installdeps . does not do anything, it says:

      --> Working on . Configuring XXX-0.01 ... OK <== Installed dependencies for .. Finishing.

      so no joy with this as there are tons of dependencies.

Re: Install dependencies of module
by LanX (Saint) on Mar 07, 2023 at 15:16 UTC
    Hmm ... did you check if the META.json in your distribution is up to date, including all prereqs?

    Cheers Rolf
    (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
    Wikisyntax for the Monastery

      There is META.yml with a correct require section. And there are MYMETA.json/yml which are also correct in the dependencies. (sorry I edited this 1 min after).