Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Symlinks with PAR::Packer not working on Windows

by Anonymous Monk
on Jul 06, 2021 at 20:32 UTC ( [id://11134724]=note: print w/replies, xml ) Need Help??


in reply to Symlinks with PAR::Packer not working on Windows

Hi

What do you get if you  set PAR_GLOBAL_DEBUG=999 before you run script1.exe?

A hardlink works fine for me :/

What is "Windows" exactly? What is a minimal "pack.exe" exactly? And how exactly did you create "pack.exe"?

Replies are listed 'Best First'.
Re^2: Symlinks with PAR::Packer not working on Windows
by kaldor (Beadle) on Jul 08, 2021 at 18:59 UTC

    Hi,

    as an example, I have 3 scripts that contain only :

    use 5.010; say $0;
    C:\test>pp -o pack.exe script1.pl script2.pl script3.pl

    Then I move pack.exe to another machine (running Windows Server 2016) :

    Renaming works :

    C:\test>rename pack.exe script1.exe C:\test>script1.exe C:\test\script1.exe C:\test>rename script1.exe pack.exe

    Hard-linking works :

    C:\test>mklink /h script1.exe pack.exe Hardlink created for script1.exe <<===>> pack.exe C:\test>script1.exe C:\test\script1.exe C:\test>del script1.exe

    Soft-linking doesn't :

    C:\test>mklink script1.exe pack.exe symbolic link created for script1.exe <<===>> pack.exe C:\test>set PAR_GLOBAL_DEBUG=999 C:\test>script1.exe Usage: C:\test\script1.exe [ -Alib.par ] [ -Idir ] [ -Mmodule ] [ src. +par ] [ program.pl ] C:\test\script1.exe [ -B|-b ] [-Ooutfile] src.par

      Do you get the same problem if you only pack one script?

      Also, it would be useful to output the contents of some of the PAR environment variables to see what PAR thinks it is dealing with, for example PAR_0, PAR_PROGNAME and PAR_GLOBAL_TEMP. See PAR::Environment. That's assuming it gets that far, of course.

      use 5.010; say $ENV{PAR_0}; say $ENV{PAR_PROGNAME}; say $ENV{PAR_GLOBAL_TEMP}; say $0;

      More generally, in the past when I've packed multiple scripts I usually packed the first (child) script as an exe, and then included that as an extra file resource when packing the parent script (using the --addfile argument). The parent script can use logic based on $ENV{PAR_0} to decide if it should call a perl script or a packed executable. Any packed resource will be under $ENV{PAR_TMP}/inc.

      This approach leads to duplication in what is packed because dependencies are packed separately in each exe. However, it is simpler to wrangle and duplication is not really an issue unless there are large dependencies.

        I get the same result when packing a single or multiple scripts.

        Using set PAR_DEBUG=999 or say $ENV{PAR_*} (good advice, by the way) doesn't change the output.

        About your technique of packing child/parent scripts as .exe, doesn't it also duplicate the perl interpreter? The executable's size with a single empty script is already about 8MB, I'm afraid it would result in a huge file.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11134724]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-25 23:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found