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

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

by kaldor (Sexton)
on Jul 08, 2021 at 18:59 UTC ( #11134809=note: print w/replies, xml ) Need Help??

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


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

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

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 ] [ ] C:\test\script1.exe [ -B|-b ] [-Ooutfile] src.par

Replies are listed 'Best First'.
Re^3: Symlinks with PAR::Packer not working on Windows
by swl (Vicar) on Jul 08, 2021 at 22:21 UTC

    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.

        It looks like the system does not get so far as to be able to run any code, as pointed to in the code link in 11134827.

        In terms of packing exes in exes, their contents are independent so the perl interpreter will be duplicated. Whether one considers 8MB (or 64MB) huge is a matter of context, e.g. whether the target systems are resource constrained or not.

Re^3: Symlinks with PAR::Packer not working on Windows
by Anonymous Monk on Jul 09, 2021 at 03:10 UTC

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (1)
As of 2021-10-18 05:38 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (72 votes). Check out past polls.