Search code examples
perlcpancpanm

Installing cpan or cpanm modules on a behind-firewall machine with no Internet connection


I've already read related threads like these, but they do not fully capture our situation.

  1. This is on a firewalled machine. No net access. We can ftp files to folders and install modules from there.
  2. We have CHMOD 777 for our users on some folders. We can install Perl modules if we locally build them by downloading the relevant .pm files. But when these files cannot install, we do not have any cpan or cpanm.

I'd like to install, for example, HTML::Restrict. If I do the download + install thing, the Restrict.pm gives me this error:

/lib/HTML/Restrict.PM:328: Unknown command paragraph "=encoding UTF-8" 

Reading a bit online suggests that this could be an old Perl problem. We use 5.8.x. Our own dev machines have the luxury of 5.16.x and internet access so installing module is a cinch. Anyway, one of my older machines also has 5.8.x, and installing the module via cpanminus worked there (with internet).

So, question: is it possible to install "cpanminus" (cpanm) through FTP, then upload specific module files to the server through FTP too, and then go into shell and install modules via cpanm by pointing it to respective .pm files?

Thank you for any pointers.


Solution

  • I still don't really understand your thinking, but you can get a stand-alone version of cpanm using curl. For instance

    curl -sS --location https://cpanmin.us/ --output cpanm
    

    then you should be able to just copy it to your target machine, put it on your PATH, and do

    cpanm HTML-Restrict-2.2.2.tar.gz
    

    but I doubt if you will find any change to the specific errors you are getting