问题
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?
回答1:
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
回答2:
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.
回答3:
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 :
- Download the module
.tar.gz
file - Uncompress it
- Open a
cmd
in the module directory - Type
perl Makefile.PL
- Type
dmake
, look if there is no error - Type
dmake test
, look if there is no error - 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.
来源:https://stackoverflow.com/questions/14957069/how-do-i-compile-a-perl-module-on-windows-with-strawberry