Search code examples
perlmodulecpancpanm

CPANM, "Couldn't find module or a distribution Archive::zip"


I am trying to write something in Perl that needs several modules, however this is my first time using Perl and I cannot seem to install one specific module I need, Archive::zip.

I am using perlbrew and use the following command to attempt to install the module:

cpanm install Archive::zip

This returns to me the following messages through the command line:

install is up to date. (0.01)
! Finding Archive::zip on cpanmetadb failed.
! Finding Archive::zip () on mirror http://www.cpan.org failed.
! Couldn't find module or a distribution Archive::zip

At first I thought that the "install is up to date meant" I had it, but anything I attempt to run requiring that module tells me that it is missing. I assume the messages after mean that it cannot find any place to install this module from, and I don't seem to have come across this issue posted anywhere online. If that is the case is there a different mirror I can specify?

In case it may be relevant to this, I am currently using OSX 10.10.2.


Solution

  • Module names are case sensitive: you want Archive::Zip, with a capital 'Z'.

    Also, when installing a module using cpanm, you can save a few keystrokes by omitting install, it's the default behaviour. Quoting from the documentation:

    (arguments)

    [...]

    -i, --install

    Installs the modules. This is a default behavior and this is just a compatibility option to make it work like cpan or cpanp.

    This means you can install Archive::Zip using

    cpanm Archive::Zip