8

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.

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
DoolAy
  • 247
  • 3
  • 9
  • 4
    It should be `Archive::Zip`, with a capital `Z` (Perl is case sensitive). – ThisSuitIsBlackNot Jul 07 '15 at 00:55
  • 4
    Also, `install` is not required, is it? `cpanm Archive::Zip` should be enough. `install` is the default behaviour, see [documentation](http://search.cpan.org/~miyagawa/App-cpanminus-1.7039/bin/cpanm). – Benjamin W. Jul 07 '15 at 01:12

2 Answers2

1

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
Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
  • I think I was following an outdated tutorial and it might have had the wrong command. I eventually just installed it manually. Thanks for the help! – DoolAy Jul 09 '15 at 20:02
0

As the previous poster noted, module names are case-sensitive, so "cpanm Archive::zip" won't find "Archive::Zip."

As for "install is up to date", this is a bit confusing at first. The cpanm program takes options, which begin with a dash, and arguments, which don't. If you don't specify any options, the default behavior is to install the modules you specify as arguments. So the proper command is just "cpanm Archive::Zip". If you want to tell cpanm to do something else, you would say it with an option: for example, "cpanm --showdeps Some::Module" would show the dependencies of Some::Module but not install anything.

If you say "cpanm install Archive::Zip", what you're telling it to do is first install the module called "install" and secondly install "Archive::Zip." And there is a module called "install" -- it doesn't do anything, but was created specifically to avoid "Couldn't find module or distribution" errors when people absentmindedly typed "cpan install Some::Module". So "install is up to date (0.01)" means that you have previously installed the "install" module, and the version you have is the latest version. (Which is not surprising as a module that doesn't do anything is not likely to need revision.)