首页 > 代码库 > How to generate exe for your PERL script?

How to generate exe for your PERL script?

The way I am using is PAR Packer.

 

1.      Downloadmodule PAR Packer:

http://search.cpan.org/~rschupp/PAR-Packer-1.024/lib/PAR/Packer.pm

2.      InstallPAR Packer:

2.1 Unzipthe *.tar

2.2 Go tothe directory and run “perl Makefile,pl”, if you are using active perl, you mayget some error about you don’t have GCC compiler, you need to install migGW asmentioned in step3

3.      Downloadand Install MinGW: from website:http://www.mingw.org/

The version I used is: http://tdm-gcc.tdragon.net/download

3.1 Payattention if you already add the value path ” C:\MinGW\64\bin” in your systemVariables

3.2 Run gcc –v to see if it issuccessfully installed:

C:\Rebecca\script\perl>gcc -v

Using built-in specs.

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=C:/MinGW/64/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.2/

Target: x86_64-w64-mingw32

Configured with: ../../../src/gcc-4.9.2/configure--build=x86_64-w64-mingw32

Thread model: posix

gcc version 4.9.2 (tdm64-1)

 

4.      Run perl Makefile.pl, you may get the followingerrors:

C:\Users\rebecca\Desktop\PAR-Packer-1.024>perlMakefile.pl

 

It looks like you don‘t have either nmake.exe ordmake.exe on your PATH,

so you will not be able to execute the commands froma Makefile.  You can

install dmake.exe with the Perl Package Manager byrunning:

 

ppm install dmake

                you need to install dmake assuggested, you can run “ppm install dmake”, but you may get the followingerrors:

C:\Rebecca\script\perl>ppm install dmake

Downloading ActiveState Package Repositorypacklist...redirect

Downloading ActiveState Package Repository packlist...failed401 Unauthorized

Syncing site PPM database with .packlists...done

Syncing perl PPM database with .packlists...done

Downloading dmake-4.11.20080107...redirect

Downloading dmake-4.11.20080107...failed 401 Unauthorized

ppm install failed: 401 Unauthorized

                Itis because the Active Perl you are using now is not business version, itdoesn’t support to install automatically online. You need to install itmanually by following step5

5.      Installdmake: http://search.cpan.org/dist/dmake/

According to the instruction in README.TXT:

So, to install it, just copy dmake.exe and the startupsubdirectory to some location on your path.

6.      Checkif you already have dmake successfully installed:

C:\Rebecca\script\perl>dmake -V

dmake - Version 4.12.2.2 (Windows / MS Visual C++)

Copyright (c) 1990,...,1997 by WTI Corp.

 

Default Configuration:

        MAXLINELENGTH := 32766

       MAXPROCESSLIMIT := 64

        .IMPORT.IGNORE: DMAKEROOT

        .MAKEFILES :makefile.mk makefile

        .SOURCE    : .NULL

        DMAKEROOT *=$(ABSMAKECMD:d)startup

        MAKESTARTUP :=$(DMAKEROOT)\startup.mk

 

Please read the NEWS file for the latest release notes.

7.      Go toPAR Packer directory:

perl Makefile.pl

dmake

dmake install

8.      Generatethe exe:

C:\Rebecca\script\perl>pp -o hello.exe hello.pl

 

9.      Done

How to generate exe for your PERL script?