How to install Perl CPAN Modules Offline

I have a situation where I’m able to download a CPAN module distribution, but I’m behind a firewall and I therefore can’t install the module using the cpan installer. The recommended offline solution is to use the CPAN Mini Mirror. But that presents the same problem: It expects to have Internet access.

The solution is simple – don’t use the CPAN installer! Just do the Makefile yourself. Here is how I installed the Test::Class module:

tar xzf Test-Class-0.37.tar.gz
cd Test-Class-0.37
perl Makefile.PL
make
make test
make install

If you can’t do it the easy way, don’t forget you can do it the “Old School” way!