5

I am aware you can easily configure cpan to use a specific mirror. However I recently started using cpanm at the advice of a friend, and I can't seem to find a way to set the default mirror without specifying --mirror http://cpan.metacpan.org on the command line each time.

Is there an environment variable or a config file that I can set the default mirror?

As for why I would want to simply not use the default list of mirrors, I am an FI and we are firewalled to no end. Only one mirror has been allowed through our firewall.

Bill
  • 89
  • 9
  • *"I an an FI"* Financial Institution? Faecally Incontinent? If your words matter then please don't use arcane abbreviations. – Borodin Dec 05 '17 at 20:56
  • 1
    It sounds like it would be useful to download your own copy of a CPAN repository on a properly-connected system and sideload it to your isolated machine. Take a look at [`minicpan`](http://search.cpan.org/~rjbs/CPAN-Mini-1.111016/bin/minicpan) – Borodin Dec 05 '17 at 20:58

1 Answers1

4

Cite from the cpanm docs

ENVIRONMENT VARIABLES

PERL_CPANM_OPT If set, adds a set of default options to every cpanm command. These options come first, and so are overridden by command-line options.

So try: export PERL_CPANM_OPT="--mirror http://cpan.metacpan.org"

clt60
  • 62,119
  • 17
  • 107
  • 194