3

This is more an open discussion and a conclusion than a real question, hoping it can help someone sometime.

I was looking on how to make Perl module on an Internet disconnected server (otherwise the answer is quite simple: use cpan), so the only option I have is to manually compile the modules downloaded from the Internet (CPAN or others) directly on the server.

The problem was that, on a standard Windows server, there is no compiler. So how do I make the modules?

Greg Bacon
  • 134,834
  • 32
  • 188
  • 245
gyzpunk
  • 380
  • 6
  • 11

3 Answers3

5

If you look in your Strawberry Perl installation folder you will see a number of useful utilities, including the compilers cpp.exe, c++.exe, gcc.exe and make utilities gmake.exe and dmake.exe.

dmake and gcc together support the use of cpan on your installation, and cpanm is available as well.

For information on the general process of installing a module, take a look at perlmodinstall

Borodin
  • 126,100
  • 9
  • 70
  • 144
  • 1
    Perfect generic answer which cover all types of Perl installations. Nonetheless I think that the better answer should be centered on Strawberry installation case. – gyzpunk Feb 20 '13 at 09:30
  • @gyzpunk: I'm not clear what else you want to know. Strawberry Perl has been built and distributed so that the standard method of using `cpan` to install modules works fine in the vast majority of cases. This (or `cpanm`, which is also available) is the recommended method. You say "The problem was that, on a standard Windows server, there is no compiler" and I have solved that by telling you that the the necessary compiler *is* available under Strawberry Perl, and you can build modules in isolation using the standard procedure. – Borodin Feb 20 '13 at 11:24
  • Yes, you're entirelly right and, as I said, you perfectly answered to my question. My only concern was to give a sort of guide to a completely new user of Strawberry. – gyzpunk Feb 20 '13 at 12:48
  • Strawberry perl has deprecated dmake.exe. Use gmake.exe instead. See https://strawberryperl.com/release-notes/5.26.0.1-64bit.html – Wes Feb 19 '21 at 17:26
3

Strawberry Perl includes the necessary compiler environment in the default installation, so compiling modules is no problem.

As for installing modules in an offline environment, I am highly partial to using cpanmini. Basically, you create a minimal mirror of all of CPAN using a machine with internet access, then throw that onto your offline machine. Change the cpan program's settings to point to this local mirror. Now you can install nearly any module just like normal with cpan.

It may seem like overkill, but it is really very simple. The CPAN mirror takes up only about 2GB of space, which is nothing these days. You can put it on a USB stick, DVD, or whatever. And it is a once-for-all solution--the next time you want to install a module, it is already there.

2

Guys behind Strawberry were smart by packaging among with Perl binaries all you'll need under the <Strawberry install dir>\c\bin directory.

Then, to compile a Perl module offline directly on a Windows server, the process is quite simple :

  1. Download the module .tar.gz file
  2. Uncompress it
  3. Open a cmd in the module directory
  4. Type perl Makefile.PL
  5. Type dmake, look if there is no error
  6. Type dmake test, look if there is no error
  7. Type dmake install, look if there is no error

And you should be ok !

Don't hesitate to complete this article or to ask your questions in order to improve it.

Axeman
  • 29,660
  • 2
  • 47
  • 102
gyzpunk
  • 380
  • 6
  • 11
  • For anyone visiting this in the far distant future and who may also be a newbie, some distributions don't have a Makefile.PL files, and instead have a Build.PL file. this is highlighted in this answer: https://stackoverflow.com/a/7542396/13303690 and may be helpful to some. – Chris R Jun 03 '21 at 20:44