How do I compile a Perl module on Windows with Str

2019-03-02 04:59发布

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?

3条回答
Fickle 薄情
2楼-- · 2019-03-02 05:26

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

查看更多
劳资没心,怎么记你
3楼-- · 2019-03-02 05:35

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.

查看更多
虎瘦雄心在
4楼-- · 2019-03-02 05:38

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.

查看更多
登录 后发表回答