Perl scripts for perl-less people

Today I needed to hack to together a quick perl script that was to run on another person's computer. It would have been total overkill to install cygwin and perl on his machine just to run a 10 line script. So instead I googled and determined that I could compile my script using a program included with perl called perlcc. I was doubtful that it would work under windows, but I decided to try anyways. It worked! So here is a quick how to compile perl under windows using cygwin and perlcc.

First off run perlcc --help. My script was simple with no extra modules, but yours might be more complex - the help screen will pick up where this simple howto fails.

In the same directory as your perl file run:
perlcc -o foo.exe foo.pl

Then open the folder in windows explorer and double click on foo.exe. It will probably complain about a missing dll (cywin1.dll will probably be the first one). Copy cygwin1.dll from /bin (C:\cygwin\bin) to the folder. Run it again and it will complain about a perl dll. Copy the perl dll (again from /bin) to the same folder. Repeat the process until you have all of the dlls it wants and your script runs in a DOS window. Now you should be able to send this folder to anyone and they can run foo.exe from it. Even after all these years perl still gives me the warm fuzzies.

2 Response to Perl scripts for perl-less people

  1. Leannonn says:

    Hi,

    I've tried that, but after it says:
    ---
    'cl' is not recognized as an internal or external command,
    operable program or batch file.
    'link' is not recognized as an internal or external command,
    operable program or batch file.
    ---

    Any ideas what might be wrong? Thanks...


    Leannonn

  2. Mike says:

    Is that the result of perlcc running, or the results of your compiled perl program?

Post a Comment