It is a common pattern: customers let me develop on hosts that cannot access Internet directly. Opening connectivities takes always a lot of time and sometimes it is against policies, but there is a hope…

The camel replicates!

In this article is that kind of host, and of course it is needed a that can connect to Internet or at least to a CPAN mirror.

If you want a full featured tool, consider using Pinto or Carton: this article describes just a very simple trick I found to deal with this network limitation.


I assume both hosts has same OS and Perl version for simplicity. In particular, different versions of Perl can lead to issues when resolving dependencies on core modules.

Start on you need a working cpan client that had at least a first run. It is nice to have A CPAN client that works like a charm.


The trick is to realize that ~/.cpan/sources is a mini CPAN mirror with all dependencies needed.

So install everything you need with your cpan client on I usually have a Makefile.PL that includes all dependencies information, it is a good idea.

If everything looks ok, I mean stable, then launch

$ cd ~/.cpan/sources
$ tar czf /tmp/cpanSources.tar.gz modules/ authors/

Now, transfer cpanSources.tar.gz to somehow. I usually need to connect opening some VPN, so I do not assume there is a connection between the hosts.

On make sure you have a working cpan client too, then

$ mkdir -p /home/unica/.cpan/sources
$ cd ~/.cpan/sources
$ tar xzf /path/to/cpanSources.tar.gz

and you are done! Your cpan client on will not fetch sources from CPAN mirrors. In fact, by default, cpan uses the ~/.cpan/sources for caching the sources tarballs, and if the distro is already there it will not try to download it. Hence you can install all dependencies needed by your package even in those hosts that are isolated from Internet, those hosts where probably you work to pay your rent :)