PAR Compiling Perl scripts into executables: Difference between revisions
From Rabbi Blog
(New page: =Disclaimer= I started reading the [http://www.expertsrt.com/tutorials/Matt/perlPAR.html Compiling Perl Scripts into Standalone Executables] tutorial by NicholasSolutions, which coincident...) |
mNo edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 6: | Line 6: | ||
=The Parts= | =The Parts= | ||
This installation was performed with ActivePerl-5.8.8.820-MSWin32-x86-274739 as the base Perl installation. The same issue ( | This installation was performed with ActivePerl-5.8.8.820-MSWin32-x86-274739 as the base Perl installation. The same issue (see below) occurred with 5.8.7. | ||
Grab the following files - '''DO NOT INSTALL THEM YET!''' | Grab the following files - '''DO NOT INSTALL THEM YET!''' | ||
Line 92: | Line 92: | ||
That's it. I've been able to create a couple exe's right off the bat with this and I've been finally freed of my perl2exe license. | That's it. I've been able to create a couple exe's right off the bat with this and I've been finally freed of my perl2exe license. | ||
[[Category:2007-07]] | [[Category:Weblog-2007-07]] | ||
[[Category:Perl]] | [[Category:Perl]] |
Latest revision as of 14:46, 31 December 2007
Disclaimer
I started reading the Compiling Perl Scripts into Standalone Executables tutorial by NicholasSolutions, which coincidently has a Creative Commons license that prohibits building on the tutorial, which makes this bad for two reasons. The first is that the tutorial is not being updated and the second is that no one can really do anything for the web in updating it due to the license. So apparently I've uncovered my first dislike of CC!
Instead of reproducing what is there, I'm going to simply do the laundry list approach and cite the error that caused me to Google for a bit, then to try my own solution.
The Parts
This installation was performed with ActivePerl-5.8.8.820-MSWin32-x86-274739 as the base Perl installation. The same issue (see below) occurred with 5.8.7.
Grab the following files - DO NOT INSTALL THEM YET!
nmake
- Move nmake15.exe to c:\perl\bin
- execute nmake15.exe to create NMAKE.ERR NMAKE.EXE and README.TXT (readme is not needed)
Perl Modules
For each of the modules listed above (2 through 6), in the order listed, do the following:
- Unpack (unzip,gunzip)
- From the command line within the directory created:
- perl makefile.pl
- nmake
- nmake test
- nmake install
Can't find par loader
- Type pp from the command line. If you get the following error, you arrived at the same place I did.
Can't find par loader at C:/Perl/site/lib/PAR/Packer.pm line 101.
Fix PP
Repeat the Perl Modules step for Par.089 and install that module. Run the test again. You should not get an error.
PP commands
From Par-08.9, here command examples. Note: When running on Microsoft Windows, the a.out below will be replaced by a.exe instead.
% pp hello # Pack 'hello' into executable 'a.out' % pp -o hello hello.pl # Pack 'hello.pl' into executable 'hello' % pp -o foo foo.pl bar.pl # Pack 'foo.pl' and 'bar.pl' into 'foo' % ./foo # Run 'foo.pl' inside 'foo' % mv foo bar; ./bar # Run 'bar.pl' inside 'foo' % mv bar baz; ./baz # Error: Can't open perl script "baz" % pp -p file # Creates a PAR file, 'a.par' % pp -o hello a.par # Pack 'a.par' to executable 'hello' % pp -S -o hello file # Combine the two steps above % pp -p -o out.par file # Creates 'out.par' from 'file' % pp -B -p -o out.par file # same as above, but bundles core modules % pp -P -o out.pl file # Creates 'out.pl' from 'file' % pp -B -p -o out.pl file # same as above, but bundles core modules # (-B is assumed when making executables) % pp -e "print 123" # Pack a one-liner into 'a.out' % pp -p -e "print 123" # Creates a PAR file 'a.par' % pp -P -e "print 123" # Creates a perl script 'a.pl' % pp -c hello # Check dependencies from "perl -c hello" % pp -x hello # Check dependencies from "perl hello" % pp -n -x hello # same as above, but skips static scanning % pp -I /foo hello # Extra include paths % pp -M Foo::Bar hello # Extra modules in the include path % pp -M abbrev.pl hello # Extra libraries in the include path % pp -X Foo::Bar hello # Exclude modules % pp -a data.txt hello # Additional data files % pp -r hello # Pack 'hello' into 'a.out', runs 'a.out' % pp -r hello a b c # Pack 'hello' into 'a.out', runs 'a.out' # with arguments 'a b c' % pp hello --log=c # Pack 'hello' into 'a.out', logs # messages into 'c' # Pack 'hello' into a console-less 'out.exe' with icon (Win32 only) % pp --gui --icon hello.ico -o out.exe hello
Wrap Up
That's it. I've been able to create a couple exe's right off the bat with this and I've been finally freed of my perl2exe license.