I get this error:
Can\'t locate Foo.pm in @INC
Is there an easier way to install it than downloading, untarring, making, etc?
Secure solution
Many answers mention the use of the cpan
utility (which uses CPAN.pm
) without a word on security. By default, CPAN
2.27 and earlier configures urllist
to use a http URL (namely, http://www.cpan.org/), which allows MITM attacks, thus is insecure. This is what is used to download the CHECKSUMS
files, so that it needs to be changed to a secure URL (e.g. https://www.cpan.org/).
So, after running cpan and accepting the default configuration, you need to modify the generated MyConfig.pm
file (the full path is output) in the following way. Replace
'urllist' => [q[http://www.cpan.org/]],
by
'urllist' => [q[https://www.cpan.org/]],
Note: https is not sufficient; you also need a web site you can trust. So, be careful if you want to choose some arbitrary mirror.
Then you can use cpan
in the usual way.
My bug report on rt.cpan.org about the insecure URL.