in reply to Shipping standalone perl apps on Win32

Just a question ... you say that after you generate the EXE you may need to copy the DLLs it uses into the same directory as is the EXE. But there's a big problem with this. Suppose you use two modules Foo::Something and Bar::Something. Both these modules have an XS part and therefore a DLL. But both DLLs are named Something.DLL !!!

How do you solve this?

I'm not sure about perl2exe, but PerlApp (from ActiveState's PDK) solves this by renaming the DLLs based on their MD5 hash (eg. 818b4489de35cc38bfbca181f20a1f1e.dll) and somehow changes the DLL loading so that the right DLL is found. Plus PerlApp and perl2exe packs the DLLs into the EXE so you do not have to care about them. To install your application you only have to copy the EXE.

I don't say App::Packer is useless, far from it, but I'm afraid it'll take some time for it to get where perl2exe and PerlApp are now.

Jenda

  • Comment on Re: Shipping standalone perl apps on Win32

Replies are listed 'Best First'.
Re: Shipping standalone perl apps on Win32
by crenz (Priest) on Nov 28, 2002 at 23:40 UTC

    You're perfectly right, although perl2exe and perlApp seem to have their own problems :-)

    It seems like PAR and App::Packer might be merging soon, so let's hope something good comes out of this marriage.

    On another note -- another solution I found proposed is to just put wperl.exe, perl56.dll, the script and the necessary libraries in lib/ into a directory and install it like that. It also works nicely, and starts up faster. You could always create a shortcut to start the app.

      I use tinyperl to do make small exe file, It is quite buggy but it works fine for very basics (not extra libraries used) things. Usually my exe are 94 Ko. plus the perl58.dll which is 380 ko. Do you think I can do stuff like that with a regular perl exe from your packager?? What would be the size of it?? thanx.. piČ
        I use tinyperl as well! And since this thread is about packing Perl scripts and running them on Win32 machines, I would like to mention of my little script which I wrote a while ago. It basically does the same thing, but instead of generating an exe file, it outputs a js file. As you know, Windows can execute js files the same way as exe files. The only difference is in speed. Exe files may execute in a blink of an eye. Js files may take a second.

        So, my script requires a list of files to be given to it with source name and destination name, and each file must be marked manually. When the user double-clicks on the js file, the js program unpacks Tinyperl 5.8 on the user's machine and executes the perl script(s) which were previously marked. TinyPerl consists of two files: PERL58.DLL and TINYPERL.EXE. The total of these two files is about 500KB. So, these two files are automatically installed into C:\PERL58 folder, and then the perl scripts and packages can be dumped into the same folder or into different folders. The directory structure is automatically created by the installer JS script which is included in the perl packager.

        If you want to try this, click the link below. However, be warned, this will download a 1.2 megabyte text file on your computer. Rename the .txt file to .pl file, and that's the only thing you need. That's your installation script. It's big because it includes a copy of Tinyperl 5.8 encoded as text.

        http://www.wzsn.net/perl/runpl.txt

        If you are not sure if you want to download this, here is a preview of the file:

        #!/usr/bin/perl # # WINDOWS PERL CLICK-N-RUN by Zsolt v1.0 # # This Perl script creates a JavaScript file which unpacks # TinyPerl 5.8 interpreter and your custom Perl script on # a target PC without any prompt or question. The user is supposed # to double-clicks on the JS file to execute it, and when that # happens, TinyPerl is automatically installed on the computer # in less than one second, and your perl script starts to run # in a Windows environment. # # Now, this program can also be used for nefarious purposes such # as destroying Windows or installing spyware, so right now I will # include a short disclaimer here: YOU REALIZE THAT THE PROGRAMS # GENERATED BY THIS PROGRAM CAN DAMAGE A COMPUTER. YOU USE THIS # SOFTWARE AT YOUR OWN RISK. PERIOD. # # All right, so in a nutshell, this program allows the execution of # a Perl script on a Windows PC where you do not know if Perl # is already installed or not. # # The advantage of TinyPerl 5.8 is that it's very small and will run # on all 32-bit and 64-bit versions of Windows. The disadvantage is th +at # no modules are installed by default, so you can't even include somet +hing # like "use warnings;" because that would fetch the warnings.pm file, +which # might not exist on the target PC. If you want it to exist, then you +have # to include it. And if a module depends on other modules, you'll # have to know which ones are needed and include them as well. # # Sharing JS files online is made difficult by Windows. # You can't just download and run a JS script, because most spyware # infections begin by unwittingly clicking on JS file. So, Windows # made sure that users can't do that easily. In order to run a JS file +, # you must download the JS file as a TXT file. Then you have to # give it a JS extension, and then you can double-click on it to run. # Once you double-click on the JS file, from there, everything # happens automatically. The script extracts the Perl program and # installs the TinyPerl interpreter and executes your Perl script. # You will not see any windows pop up except what is generated # by the Perl program's execution. # ###################################################################### +# use strict; use warnings; ###################################################################### +# # # THE FOLLOWING FILES WILL BE ADDED TO THE PACKAGE. WHEN THE JS PROGRA +M # RUNS, THE DESTINATION SUB-DIRECTORIES AND FILES WILL BE CREATED # AUTOMATICALLY _BEFORE_ THE PERL SCRIPT EXECUTION BEGINS. # # FLAGS AND THEIR MEANING: # A = Set Archive attribute for file # H = Set Hidden attribute for file # R = Set Read-only attribute for file # O = Overwrite file even if it already exists # # D = Just create a directory # # X = Execute this script in normal window. # M = Run this script in a minimized window. # W = Wait. Run this script and wait until it exits # before executing next script in line. # P = Pause. Run this script and keep its terminal window open. # The user will be asked to press Enter before script window clo +ses. # # Even if you are unpacking just one PL file, you should turn on one o +f the # X/M/W/P flags which indicates that this file is to be executed. # # VERY IMPORTANT: ANY PERL SCRIPT WHICH IS GOING TO BE EXECUTED SHOULD # NOT CONTAIN ANY SPACES IN THE FILE NAME OR PATH!!! For example: # This is wrong: "C:\Program Files\my script\runthis.pl" # This is wrong: "C:\PERL58\my script.pl" # The right way: "C:\PERL58\my_script.pl" # # The input and output file names must not contain any special # characters or unicode characters! # # If you include several PL files, more than one of them can have # have the 'X' flag. The perl scripts will be executed AFTER all # files have been unpacked. They will be executed in the order # they appear in the list! # my @FILES = ( # FLAGS FILE SOURCE DESTINATION # ----- ---------------------- ------------------------ 'AOP', 'C:\\DESKTOP\\ROBINHOOD\\robinhood.pl', 'C:\\PERL58\\ROBINHOO +D.PL' # Execute this script );