0

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.

Community
  • 1
  • 1
PKHunter
  • 682
  • 2
  • 13
  • 28
  • You misunderstood my question. I want cpanm to install modules to which i point on the local server somewhere. Not for cpanm to look for those modules online, as it does by default. Hope this is clearer. – PKHunter Sep 19 '15 at 12:40
  • I'm still unsure what it is you want. The specific issue you have with installing `HTML::Restrict` is because of [an old bug in `Pod::Perldoc`](https://rt.cpan.org/Public/Bug/Display.html?id=26121) but that doesn't affect your ability to install modules in general. I don't see what difference you think installing `App::cpanminus` will make – Borodin Sep 19 '15 at 13:50
  • Thank you for that info. With Perl 5.8.x, is there any way to fix that old Pod::Perldoc issue? – PKHunter Sep 19 '15 at 14:58
  • 1
    I really don't know. You could try fetching `cpanm` as I describe in my answer and see if it will update `Pod::Perldoc` for you. But the proper way, of course, is to upgrade Perl! – Borodin Sep 19 '15 at 15:23
  • This is just bloody stupid. Using an antiquated Perl version and needing modules without the ability to install them from CPAN is just boneheaded design. Take a quill and ask your manager why they can use email while your software needs to stay put firmly in the middle ages, and the labor costs this incurs are at 21th century rates. – reinierpost Sep 19 '15 at 19:43
  • I couldn't agree more. But the system we use is antiquated. Anyway, we found a way using HTML::TokeParser, which is kludgish, but works for now. Thank you. – PKHunter Sep 20 '15 at 10:44

2 Answers2

2

You should take a look at perldoc perlmodinstall which goes into detail about how to install a module from its distribution. It follows what should be a familiar incantation

  • Decompress
  • Unpack
  • Build
  • Test
  • Install

Assuming you're on a Linux system, this commonly takes take the form of

  • gzip -d My-Module-Distribution.tar.gz
  • tar -xof My-Module-Distribution.tar
  • perl Makefile.PL
  • make
  • make test
  • make install

But after the Unpack stage you will often find a README file or other text file that will describe any unusual steps to be taken

Clearly some of these steps can be combined. For instance, most people will probably want to use

tar -xvfz My-Module-Distribution.tar.gz

to avoid having to invoke gzip separately. Likewise, the make system will force a build phase as a prerequisite if you use just

make test

without the preceding make

The linked document has a lot to say about how to install on other platforms, should you not be running a Linux variant

Borodin
  • 126,100
  • 9
  • 70
  • 144
1

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

Borodin
  • 126,100
  • 9
  • 70
  • 144