in reply to Error when compiling perl-script to executable

If you want to make your script executable try PAR::Packer (the Perl Archive Toolkit)

#!/usr/bin/perl use strict; use warnings; print "Hello World\n" ;

Compile it with the "pp" utility:

% pp -o hello hello.pl

That creates "hello" that can be run directly:

% ./hello Hello World

This tool is very effective in packaging stand-alone applications written in perl (packs all the modules, etc...), but I don't know at what extend the performance of the resulting executable is increased

Hope this helps

citromatik

Replies are listed 'Best First'.
Re^2: Error when compiling perl-script to executable
by jasonk (Parson) on Jul 06, 2007 at 15:24 UTC

    but I don't know at what extend the performance of the resulting executable is increased

    It isn't, performance is decreased. The way that PAR works is by creating an executable that contains all of the files that will be necessary to run the script embedded in itself. At runtime, each of those files will be extracted into a temporary directory (I think they are extracted as needed, rather than all at once at the beginning, but I'm not sure). The overhead of extracting the files is going to add a bit of extra time to the running of the script, though I don't think it's enough to worry about if PAR solves other problems for you.


    We're not surrounded, we're in a target-rich environment!
      PAR does do caching. So your startup penalty is for the first run only. HOWEVER, it does NOT "compile" any code... so PAR will run the same scripts at the same speed as before.